简体   繁体   English

jquery blockUI 和 unblockui

[英]jquery blockUI and unblocui

Having issue with unblockUI. unblockUI 有问题。 It gives compile timne error.它给出了编译时间错误。 syntax error $.unblockUI();语法错误 $.unblockUI();

<SCRIPT type="text/javascript">  
  var $ = jQuery.noConflict();
  $('#toHide').show().blockUI(); 
  setTimeout('document.getElementById("safeForm15").submit()', 100); 
  $.unblockUI(); 
</SCRIPT>

Purpose is blockUI for a period of time show laoding please wait message then unblockit or go to next page.目的是blockUI一段时间显示laoding please wait message 然后unblockit或者go到下一页。

after removing } im getting another error: ie删除 } 后我得到另一个错误:即

$("#toHide").show().blockUI is not a function $("#toHide").show().blockUI 不是 function

There's a stray "}" after the call to "unblockUI()".在调用“unblockUI()”之后有一个杂散的“}”。 If that's really in your code, then that would be a problem.如果这确实在您的代码中,那将是一个问题。

Also, you really should pass functions to "setTimeout()" and not strings:此外,您确实应该将函数传递给“setTimeout()”而不是字符串:

setTimeout(function() {
  $('#safeForm15').submit();
}, 100);

You're also using jQuery, so you can call "document.getElementById()" if you want but it's clearly less code if you take advantage of the library.您还使用了 jQuery,因此您可以根据需要调用“document.getElementById()”,但如果您利用该库,代码显然会更少。

You have an unmatched brace.你有一个无与伦比的支架。 The last line should be最后一行应该是

$.unblockUI();

EDIT编辑

.blockUI()

cannot be called on any object except for the jQuery object.不能在除 jQuery object 之外的任何 object 上调用。 So try:所以试试:

var $ = jQuery.noConflict();
$.blockUI();
$('#toHide').show(); 
setTimeout('document.getElementById("safeForm15").submit()', 100); 
$.unblockUI();

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

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