asp.net - How can I disable all buttons and links on my page, but still let the postback occur? -
I am trying to stop the user from clicking on more than one postback-generating element on the page. In other words, if they click on the 'continue' submit button, they should not have another postback before the original request is returned.
I had to go with two versions of jQuery code. Neither is exactly what I want:
This version will disable all postback elements, but in doing so, it prevents clicked elements from firing, for the record, I do not think that < Code> .removeAttr ('onclick') is really required, but does not seem to change the behavior except
$ (function () {$ ('a, : Button, submit '). (Function () {var element = $ (' a,: button, submit '); Elements.attr (' disabled ',' disabled '). Remove' Onclic ');});});
This version disables all Other postback elements, but it allows me to reuse the same element that was clicked - Do not want to click the button (function () {var othherelements = $ ('a: not (#' + $ (this) .attr ('id') + '),: button: no (#' + $ ( Submit): .attr ('id') + ', submit: no (#' + $ (this) .attr ('id') + ')'); elements.attr ('disabled', 'disabled') RemoveAttr ('onclick');});});
How can I stop this behavior?
I have just tested your first approach without JQuery, and it worked fine, i.e. submit Disabling the button did not prevent form submissions.
& lt; Form method = "get" & gt; & Lt; Input type = "text" name = "textfield" value = "A" /> & lt; Input type = "submit" onclick = "this.disabled = true" & gt; & Lt; / Form & gt;
Perhaps you want to double check that something else is, e.g. JQuery, running?
Comments
Post a Comment