如何防止 find :submit 启用表单中的其余按钮?

How to prevent find :submit to enable rest of the buttons in the form?

您好,我的表单可以选择 enable/disable 某些字段。如果用户选择 No 作为表单特定部分的选项,该表单中的所有字段都将被禁用。但是,我在保存表单数据时使用了这个逻辑:

frmObject.find(":submit").prop("disabled", true); // Disable submit button

然后此代码启用提交按钮:

frmMessage.show().addClass(obj.CLASS).html("Error!").delay(7000).fadeOut('slow').queue(function(){
    $(this).removeClass(obj.CLASS).dequeue();
    frmObject.find(":submit").prop('disabled', false);  // Enable submit button                                       
});

我在提交表单并成功保存启用提交按钮的代码后遇到的问题将影响表单中应保持禁用状态的其他按钮。我不确定为什么其他按钮有 <button></button> 标签而没有 type=submit。有谁知道如何防止这种行为?

I'm not sure why since the other buttons have tag and they do not have type=submit. Does anyone know how to prevent this behavior?

<button> 的默认 typesubmit。始终明确指定 type 是个好主意:

<button type="button">I'm NOT a Submit Button</button>
<button>I'm AM a Submit Button</button>