单击其他按钮后使按钮激活

Make button active after clicking other button

本文关键字:按钮 激活 单击 其他      更新时间:2023-09-26

我的button2被禁用,当有人点击Button1时,Button2将被激活。

下面是一些我想使用的代码:

function fn2() {
    c >= 1 ? alert("Bla Bla") & window.open("login.php", "_self") : window.alert("Please Click")
}

这段代码应该可以做到。我假设按钮的id为button1button2

//When button1 is clicked...
$('#button1').click(function() {
     //Set the property disabled on button2 to false.
     $('#button2').prop('disabled', false);
});

并且,像往常一样,确保在DOM准备好之前不执行此代码(例如,通过将其包装在$(function() { ... });中)。