开发者

JQuery BlockUI on "normal" forms

开发者 https://www.devze.com 2023-01-24 01:32 出处:网络
I have searched hi and low, but can\'t find an answer without a lot of work. I have a site that has lots of intensive forms. I am trying to write开发者_如何转开发 a global function that will gray out

I have searched hi and low, but can't find an answer without a lot of work. I have a site that has lots of intensive forms. I am trying to write开发者_如何转开发 a global function that will gray out or block the UI when any form is submitted on the site. They do not all have a class, an id, etc. Some submit via a regular submit button, some already have javascript submit buttons, etc.

Is there a simple way to say when any form gets submitted it will gray out the site system wide?


You can just use an element selector to get all <form> elements, then hook a handler up to the submit event, like this:

$("form").submit(function() {
  $(this).block(/* options here if needed */);
});
0

精彩评论

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

关注公众号