在表单提交上禁用Jquery UI按钮
我有一个这样的表格:
我正在使用最新版本的Jquery UI Button插件。 必须提交提交按钮的值。 是否有一种简单的方法可以在提交表单后禁用提交按钮,而无需使用其他插件,如“锁定提交” – http://plugins.jquery.com/project/LockSubmit ?
非常感谢。
设置元素的disabled属性时,不会提交。 解决方法是在提交表单后设置disabled属性。 您可以使用setTimeout()
函数,延迟时间非常短:
$("#form").submit(function() { setTimeout(function() { // .prop() requires jQuery 1.6 or higher $("#form :submit").prop("disabled", true); }, 100); });
在这里演示
另一个技巧是使用技巧:)您可以将原始提交按钮包装在div中并在表单提交时隐藏它。
在这里演示
只需将按钮属性添加type =“button”即可
你的意思是
$('#form').submit(function() {$(this).find('input:[type="submit"]').button({disabled:true})});
?
$('#form').submit(function() { $(this).find('input[type="submit"]').disable(); });