-2
我有一個HTML表所示:爲什麼我的html表格忽略點擊?
<table id="top10ItemsTable">
<tr>
<th>Item Code</th>
<th>Description</th>
<th class="rightjustifytext">Qty</th>
</tr>
. . .
我想響應點擊該表內,因此已將此添加到ready函數:
$("body").on("click", "#top10ItemsTable", function() {
alert('you clicked inside the Top 10 Items quadrant table');
});
......但擊html表格不會產生警報,除非它是微觀的或不可見的。
需要什麼捅桌子足夠堅硬,以得到它的皮屑?
看起來工作得很好^ h ttps://jsfiddle.net/rb1hyxh2/19/ –
你對任何包含該表的元素都有一個點擊處理程序嗎?該處理程序是否使用'event.stopPropagation'或'return false;'? – Barmar
請參閱http://stackoverflow.com/questions/39301652/delegated-event-binding-in-jquery/39301740#39301740對此的解釋。 – Barmar