目前我正在使用
$('#mytable tr').click(function() {
blah blah
});
Run Code Online (Sandbox Code Playgroud)
这使得所有行,包括标题可点击.如何排除标题或者<th>
?
使用<thead>
和<tbody>
标签分隔标题和正文,并将选择器更改为"#mytable tbody tr"
HTML将看起来像这样
<table>
<thead>
<tr>
...
</tr>
</thead>
<tbody>
<tr>
...
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)