Reputation: 8150
On an ASPX.Page, I have a button that performs a postback. User must be prevented from clicking it more than once. I want to do this with jQuery but
jQuery(document).ready(function() {
$('#<%= saveButton.ClientID %>').click(function() { $(this).attr('disabled', 'true'); });
});
doesn´t work for me because the button does not postback. Is there an easy way to prevent a second click while still keeping the functionality of the button?
Upvotes: 2
Views: 259
Reputation: 1482
I would suggest hiding the button on click. Disabling it won't fire the server side event. Just hide the button when it is clicked. After postback it will show itself as expected. How to disable button on postback would solve your problem.
Upvotes: 0
Reputation: 460058
$('form').submit(function(){
// On submit disable its submit button
$('input[type=submit]', this).attr('disabled', 'disabled');
});
http://jquery-howto.blogspot.com/2009/05/disable-submit-button-on-form-submit.html
Or you could block the whole user-interface with jQuery. therefore you need this plugin.
// To lock user interface
$.blockUI();
// To unlock user interface
$.unblockUI();
Upvotes: 4
Reputation: 11311
You can place button in DIV and using JavaScript you can hide div.
document.getElementById('div1').style.display = "none";
HOpe it will solve your problem.
Upvotes: 0