开发者

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');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜