[JavaScript] jQuery代码阻止表单被多次提交 →→→→→进入此内容的聊天室

来自 , 2020-04-02, 写在 JavaScript, 查看 152 次.
URL http://www.code666.cn/view/c17028c9
  1. $(document).ready(function() {
  2.   $('form').submit(function() {
  3.     if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
  4.       jQuery.data(this, "disabledOnSubmit", { submited: true });
  5.       $('input[type=submit], input[type=button]', this).each(function() {
  6.         $(this).attr("disabled", "disabled");
  7.       });
  8.       return true;
  9.     }
  10.     else
  11.     {
  12.       return false;
  13.     }
  14.   });
  15. });
  16. //javascript/3957

回复 "jQuery代码阻止表单被多次提交"

这儿你可以回复上面这条便签

captcha