单击时禁用按钮

use*_*625 6 jquery

$(document).ready(function() {
     $("#FieldsetID").each(function() {
                 $('.Isubmit').attr('disabled', 'disabled');
            });
});
Run Code Online (Sandbox Code Playgroud)

按钮显示为禁用但当我点击它的doign动作时?

是我做错了什么?

谢谢

use*_*716 2

由于某种原因,当您单击禁用的提交按钮时,IE 不会阻止事件冒泡。

我假设您的祖先上有一些其他事件处理程序因此被触发。

在该祖先的事件处理程序中,您似乎需要测试该submit按钮是否被单击以及是否被禁用。如果是这样,您将return false;阻止代码运行、提交或发生其他情况。

       // Not sure if this is the right event, but you get the idea
$( someSelector ).click(function( event ) {
    var $target  = $(event.target);
                  // check to see if the submit was clicked
                  //    and if it is disabled, and if so,
                  //    return false
    if( $target.is(':submit:disabled') ) {
        return false;
    }
});
Run Code Online (Sandbox Code Playgroud)