简体   繁体   English

jQuery BlockUI的“正常”形式

[英]JQuery BlockUI on “normal” forms

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. 我正在尝试编写一个全局函数,当在站点上提交任何表单时,该函数将变灰或阻止UI。 They do not all have a class, an id, etc. Some submit via a regular submit button, some already have javascript submit buttons, etc. 它们并不全都有一个类,一个id等。有些通过常规的提交按钮提交,有些已经具有javascript提交按钮,等等。

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事件 ,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM