Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.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 在文本框上单击鼠标右键以进行过滤,但不会触发_Javascript_Jquery_Dhtmlx - Fatal编程技术网

Javascript 在文本框上单击鼠标右键以进行过滤,但不会触发

Javascript 在文本框上单击鼠标右键以进行过滤,但不会触发,javascript,jquery,dhtmlx,Javascript,Jquery,Dhtmlx,通常触发的事件: <td style="cursor: default;"> <div class="hdrcell filter"> <input type="text" style="width:90%; font-size:8pt; font-family:Tahoma; -moz-user-select:text; "> </div> 我有一个带有过滤器的dhtmlx网格。我想捕捉发生在文本框上的事件,这些文本框用于过滤网格中的结

通常触发的事件:

<td style="cursor: default;">
<div class="hdrcell filter">
    <input type="text" style="width:90%; font-size:8pt; font-family:Tahoma; -moz-user-select:text; ">
</div>
我有一个带有过滤器的dhtmlx网格。我想捕捉发生在文本框上的事件,这些文本框用于过滤网格中的结果。原因可能是什么?

试试看:

$('div.filter').find('input[type=text]').bind('contextmenu', function(e) {
    #code
    return false;
});

呃,看调试器。它试图找到null的属性。把整件事都准备好放在文件里

$(document).ready(function(){
  $('div.filter').find('input[type=text]').mousedown(function(event) {
    debugger;
    switch (event.which) {
      case 3:
        alert('Right mouse button pressed');
        break;
    }
  });

});

工作正常。您在控制台中看到任何错误吗?网格有上下文菜单,但当右键单击过滤文本框时,我想禁用它。显然还有其他问题,因为它确实可以按原样处理您的代码。取出调试器或确保在调试器停止代码后继续。网格有上下文菜单,但我想在右键单击筛选文本框时禁用它。
$(document).ready(function(){
  $('div.filter').find('input[type=text]').mousedown(function(event) {
    debugger;
    switch (event.which) {
      case 3:
        alert('Right mouse button pressed');
        break;
    }
  });

});