Javascript 使用Jquery单击其他按钮时禁用按钮

Javascript 使用Jquery单击其他按钮时禁用按钮,javascript,jquery,svg,Javascript,Jquery,Svg,如您所见,我有两个svg形式的按钮 var g = svg.append('g') .attr('class', 'button') .attr('id', 'deploy') .attr('transform', 'translate(' + [buttonWidth / 4, 100] +')'); var g2 = svg.append('g') .attr('class', 'button') .attr('id', 'savefile'

如您所见,我有两个svg形式的按钮

    var g = svg.append('g')
    .attr('class', 'button')
    .attr('id', 'deploy')
    .attr('transform', 'translate(' + [buttonWidth / 4, 100] +')');

var g2 = svg.append('g')
    .attr('class', 'button')
    .attr('id', 'savefile')
    .attr('transform', 'translate(' + [buttonWidth / 4, 150] +')');

var g3 = svg.append('g')
    .attr('class', 'button')
    .attr('id', 'loadfile')
    .attr('transform', 'translate(' + [buttonWidth / 4,  200] + ')');
1单击id为“loadfile”的按钮时,我想禁用id为“savefile”的按钮。我已经编写了如下代码片段,但它不起作用。什么价值可能有问题

function disableButton(disableVar)
{
    console.log("disable button");
    $(disableVar).prop("disabled", true);
}
我的加载按钮如下所示:

button()
.container(g3)
.text(text3)
.count(2)
.cb(function() {
        outer.attr("pointer-events", "none");
        loadFlag = true;
        clearFlag = false;
        $(document).ready(function() {
            $("#loadfile").click(function() {
                var disableSaveFile = "#savefile";
                disableButton(disableSaveFile);
            });
        });
        update();
})();
2当我单击id为“部署”的按钮时,我想再次启用id为“保存文件”的按钮。以下代码也不适用于启用属性。我的禁用功能和部署按钮显示如下。如何解决此问题

button()
.container(g)
.text(text)
.count(0)
.cb(function() {
    outer.attr("pointer-events", "none");

                $('#deploy').click(function () {
                var enableSaveFile = "#savefile";
                    enableButton(enableSaveFile );
                });
            });
        });
})();
启用按钮功能

function enableButton(enableVar)
{
    console.log("enable button");
    $(enableVar).prop("enabled", true);
}
这是错误的:

$(enableVar).prop("enabled", true);
这就是如何使用相同的按钮场景正确地禁用和启用按钮,现在您只需要将其转换为svg

$first.clickfunction{ $second.propdisabled,true; }; $third.clickfunction{ $second.propdisabled,false; }; 点击我 使我失去能力
使用jQuery时所有可用项:$'.btn.btn small.btn primary'。单击函数{$'.btn.btn small.btn primary'。而不是$this.prop'disabled',true};这对我不起作用。当我需要放置这个参数“.btn.btn small.btn primary”时,你是什么意思?
<button class="bothButtons">Click A</button>
<button class="bothButtons">Click B</button>
$('.bothButtons').on('click', function(){
  $('.bothButtons').prop('disabled', true);
  $(this).prop('disabled', false);
});