admin管理员组文章数量:1414865
I have this very simple script of jQuery plugin called blockUI
I found many posts with the same issue but no resolution
Can someone take a look at this snippet or suggest an alternative to blockUI?
Thank you!
function block() {
alert('gonna block')
$.blockUI();
setTimeout(unBlock(), 5000);
}
function unBlock() {
$.unblockUI();
}
function alertUser() {
alert('Alert User');
}
<script src=".0.0/jquery.min.js"></script>
<script src=".blockUI/2.70/jquery.blockUI.js"></script>
<button onclick="alertUser()">Alert</button>
<button onclick="block()">Block!</button>
<button onclick="unBlock()">UnBlock!</button>
I have this very simple script of jQuery plugin called blockUI
I found many posts with the same issue but no resolution
Can someone take a look at this snippet or suggest an alternative to blockUI?
Thank you!
function block() {
alert('gonna block')
$.blockUI();
setTimeout(unBlock(), 5000);
}
function unBlock() {
$.unblockUI();
}
function alertUser() {
alert('Alert User');
}
<script src="https://cdnjs.cloudflare./ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/jquery.blockUI/2.70/jquery.blockUI.js"></script>
<button onclick="alertUser()">Alert</button>
<button onclick="block()">Block!</button>
<button onclick="unBlock()">UnBlock!</button>
Share
Improve this question
edited Feb 5, 2019 at 18:28
JavaSheriff
asked Feb 4, 2019 at 22:05
JavaSheriffJavaSheriff
7,71526 gold badges102 silver badges173 bronze badges
2 Answers
Reset to default 2You need to include jQuery before you include any plugins.
Change the order of your includes.
It does work but you are calling unblock instantly and it goes away, pass the function into setTimeout instead of calling it.
function block() {
$.blockUI();
setTimeout(unBlock, 5000);
}
function unBlock() {
$.unblockUI();
}
function alertUser() {
alert('Alert User');
}
<script src="https://cdnjs.cloudflare./ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/jquery.blockUI/2.70/jquery.blockUI.js"></script>
<button onclick="alertUser()">Alert</button>
<button onclick="block()">Block!</button>
<button onclick="unBlock()">UnBlock!</button>
本文标签: javascriptjquery block ui getting blockUI is not a functionStack Overflow
版权声明:本文标题:javascript - jquery block ui getting $.blockUI is not a function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745212284a2647960.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论