开发者

disable all selectbox onchange

below is how i disa开发者_如何学Goble all submit button on click

$('form').submit(function(){
    // On submit disable its submit button
    $('input[type=submit]', this).attr('disabled', 'disabled');
});

how to disable all selectbox onchange easily for all selectbox in the page


Something like this will disable all select boxes:

$('select').attr('disabled', 'disabled');

To tie it to a form submission you can add it to your existing function.

To bind this to a select box's onChange event you can use jQuery's change listener. So if you want all select boxes disabled when any select box changes you can use this:

$('select').change(function(){
    $('select').attr('disabled', 'disabled');
});

If you want to operate on a specific select box you can change the first $('select') above to reference that box.


Almost the same as what you're doing above, just change it to select

$('form').submit(function(){
    // On submit disable its submit button
    $('select', this).attr('disabled', 'disabled');
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜