Disable / replace button when submitting a form
How do I disable a button when a form is submit开发者_开发问答ted or better still replace it with "processing your order please wait".
Thanks.
You could disable it with the $.attr()
method,
$("input.myBtn").click(function(){
$(this).attr( 'disabled', true );
});
or replace it with text with the $.replaceWith()
method.
$("input.myBtn").click(function(){
$(this).replaceWith( '<p>Processing your order. Please wait.</p>' );
});
$('input:button').click(function() {
$(this).attr('disabled', true);
});
With jQuery:
$('#your-button-id').html('Please wait');
精彩评论