Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.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 为什么我的html表忽略了点击?_Javascript_Jquery_Html_Html Table - Fatal编程技术网

Javascript 为什么我的html表忽略了点击?

Javascript 为什么我的html表忽略了点击?,javascript,jquery,html,html-table,Javascript,Jquery,Html,Html Table,我有一个html表,如下所示: <table id="top10ItemsTable"> <tr> <th>Item Code</th> <th>Description</th> <th class="rightjustifytext">Qty</th> </tr> . . . …但单击html表不会生成警报,除非它

我有一个html表,如下所示:

<table id="top10ItemsTable">
    <tr>
        <th>Item Code</th>
        <th>Description</th>
        <th class="rightjustifytext">Qty</th>
    </tr>
    . . .
…但单击html表不会生成警报,除非它是微观的或不可见的

要把桌子戳得够硬才能把皮屑弄起来,需要什么呢?

试试这个:

$(document).on("click", "#top10ItemsTable", function () {

    alert('you clicked inside the Top 10 Items quadrant table');

})
最终代码:


项目代码
描述
数量
$(文档)。在(“单击”上,“#top10ItemsTable”,函数(){
警报(“您在前10项象限表中单击了”);
})     
您只需执行以下操作:

$("#top10ItemsTable").click(function () {
     alert('you clicked inside the Top 10 Items quadrant table');
}

看起来工作正常。在包含该表的任何元素上是否有单击处理程序?该处理程序是否使用
event.stopPropagation
返回false?请参阅以了解有关该代码的说明。
$("#top10ItemsTable").click(function () {
     alert('you clicked inside the Top 10 Items quadrant table');
}