Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/425.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在剑道UI窗口中检测触发事件的按钮?_Javascript_Jquery_Kendo Ui_Kendo Window - Fatal编程技术网

Javascript 如何在剑道UI窗口中检测触发事件的按钮?

Javascript 如何在剑道UI窗口中检测触发事件的按钮?,javascript,jquery,kendo-ui,kendo-window,Javascript,Jquery,Kendo Ui,Kendo Window,我有两个或两个以上的按钮,在某些业务逻辑之后,它们迟早都会调用.close()事件 例如,屏幕下方:“关闭”按钮将直接关闭窗口,但“保存”按钮将检查某些条件,然后触发关闭 现在,我已将我的条件添加到 that.bind('close', function(){ //check some condition // here if condition met, let the flow continue else call preventDefault() }); 当两个按钮

我有两个或两个以上的按钮,在某些业务逻辑之后,它们迟早都会调用
.close()
事件

例如,屏幕下方:“关闭”按钮将直接关闭窗口,但“保存”按钮将检查某些条件,然后触发关闭

现在,我已将我的条件添加到

that.bind('close', function(){
     //check some condition
     // here if condition met, let the flow continue else call preventDefault()
});
当两个按钮都被单击时,将触发此拦截。如何检查哪个按钮触发了事件


仅供参考,我已经扩展了剑道UI窗口小部件,因此.bind()拦截已就位。

尝试在函数中添加事件,这将允许您检查调用该函数的人。大概是这样的:

$("#closeBtnId").bind("click", function () {

});

$("#saveBtnId").bind("click", function () {

});
that.bind('close', function(e){
         var clickedButton = e.currentTarget || e.target || e.sender;
         //check some condition
         // here if condition met, let the flow continue else call preventDefault()
    });

尝试在函数中添加一个事件,这样可以检查调用该函数的人。大概是这样的:

that.bind('close', function(e){
         var clickedButton = e.currentTarget || e.target || e.sender;
         //check some condition
         // here if condition met, let the flow continue else call preventDefault()
    });