由于VM文件,单击事件触发两次

时间:2018-06-15 13:54:56

标签: jquery

我有一个点击处理程序,即使它只在1个文件中定义,也会触发两次。在调试和查看该元素上的单击处理程序时,我看到有2个脚本文件已经注册了click事件,普通文件和一个神秘的VM - " myfile"我没有做。如何阻止它访问不需要的VM脚本?

enter image description here

编辑:

html就是:<a href="#" id="clear-matches">Clear matches</a>

功能:

 $('#clear-matches').click(function (e) {
        e.preventDefault();
        bootbox.dialog({
            message: "Are you sure?  This will delete all your matches from all divisions for the latest season!!",
            buttons: {
                btn1: {
                    "label": "Cancel",
                    "className": "btn-default"
                },
                btn2: {
                    "label": "Delete",
                    "className": "btn-danger",
                    "callback": function () {
                        var data = { leagueId: leagueId }
                        $.post(window.rootUrl +  "League-ClearMatches",
                            data,
                            function (result) {
                                bootbox.alert(result);
                            });
                    }
                }
            }
        });
    });

0 个答案:

没有答案