[英]How do I bind to a table <tr>
When someone double clicks on the entire row, I want an alert. 当某人双击整个行时,我想要一个警报。 How do I bind a double click to an entire row? 如何将双击绑定到整个行?
... ...
$('#table_id tr').dblclick(function(){
alert('Hello');
});
Note: Using JQuery here, see more info about dblclick here . 注意:在此处使用JQuery,在此处查看有关dblclick的更多信息。
Well, without jQuery I suppose you could do something like this: 好吧,如果没有jQuery,我想您可以执行以下操作:
var rows = document.getElementsByTagName('tr'); // you do mean table rows, right?
var length = rows.length;
for (var i = 0; i < length; i++) {
rows[i].ondblclick = function(){alert('foo');};
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.