Enabling and Disabling Buttons using JQuery on Wizard Control
-
14-07-2021 - |
Question
I am having trouble trying to enable and disable two buttons on the last step in my asp.net wizard control.
What I am trying to achieve is when the user clicks the finish button on the wizard control the user gets presented with the javascript confirm popup box, and when the user selects confirm:
1) It disables the finish button on the wizard control 2) It enables a button on my usercontrol to become enabled
Despite all my efforts, I am struggling to get this to work.
Here is a snippet of what I have tried to do on the finish button
var answer = confirm("Click confirm if you wish to repeat steps and then click the repeat button on the screen");
if (answer == true)
{
$("input[type=submit][id=*btnFinish]").click(function()
{
$("input[type=submit][id=*btnFinish]"].atr('disabled',true);
});
}
Can anyone help?
No correct solution
OTHER TIPS
You have a spelling error
$("input[type=submit][id=*btnFinish]"].attr('disabled',true);
----------------------------------------^
Though you should be using .prop if using jQuery 1.6+
$("input[type=submit][id=*btnFinish]"].prop('disabled',true);
$("input[type=submit][id=*btnFinish]"].prop('disabled',false);
And you can remove the click function around it - since
and when the user selects confirm: - disable/enable
And just use the if/else statement you already started
if (answer){// <-- if they clicked ok
}else{
]