如何在JQuery中解绑定点击和点击提交按钮

How to unbind click and click submit button in and using JQuery?

本文关键字:提交 按钮 绑定 JQuery      更新时间:2023-09-26

我想用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
    });

我的目的是阻止UI。实际上,当我像这样阻塞UI时,控件不会转到服务器,页面也不会重新加载。即使我删除了preventDefault。谁能给我看看片段?

You can use chaining 
$('#yesBank , #worldBank').on("click", function (e) {
// rest code goes here
     }.off("click")

试试这样-

$('#yesBank , #worldBank').on("click", function (e) {
        e.preventDefault();
        $.blockUI({
            message: 'Getting List'
        });
        $(this).off('click');
    });