[英]How to unbind click and click submit button in and using JQuery?
I want to submit form in JQuery but 我想在JQuery中提交表单,但是
<input type="submit" id="yesBank" />
$('#yesBank , #worldBank').on("click", function (e) {
e.preventDefault();
$.blockUI({
message: 'Getting List'
});
//Want to unbind this click JS
//Want to click on submit button from here $(#yesBank).click("");
//Unbinding is done so that it does not execute this
//I am bound to click this button as server is handling a condition on click of it. but i have to display block ui too
});
My purpose is to block UI. 我的目的是阻止UI。 actually when i block UI like this then control does not go to server and page does not reload. 实际上,当我像这样阻止UI时,控件不会转到服务器并且页面不会重新加载。 Even if i remove preventDefault. 即使我删除了preventDefault。 Can someone show me the snippet? 有人可以向我展示摘要吗?
You can use chaining
$('#yesBank , #worldBank').on("click", function (e) {
// rest code goes here
}.off("click")
Try something like this - 试试这样的事情-
$('#yesBank , #worldBank').on("click", function (e) {
e.preventDefault();
$.blockUI({
message: 'Getting List'
});
$(this).off('click');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.