简体   繁体   English

当用户点击表格时如何检测行?

[英]How to detect row when user clicks on a table?

https://codepen.io/Maximusssssu/pen/wvdJbaa https://codepen.io/Maximusssssu/pen/wvdJbaa

Hi readers, I created a table that highlights the row when user clicks on each of the row of the table.读者您好,我创建了一个表格,当用户单击表格的每一行时,该表格会突出显示该行 I am stuck on how to pop an alert when user click on each of the row.当用户单击每一行时,我被困在如何弹出警报上。

For example, when user click on row 1, it will alert() is "1" For example, when user click on row 2, it will alert() is "2"例如,当用户单击第 1 行时,alert() 为“1” 例如,当用户单击第 2 行时,alert() 为“2”

How do i solve this?我该如何解决这个问题?

 @dblclick="dblclick"

Steps:脚步:

  1. Link your js file in html by writing this code:通过编写以下代码在 html 中链接您的 js 文件:

     link.js
  2. Write console.log(alert 1) and console.log(alert2)编写console.log(alert 1)console.log(alert2)

This is it.就是这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM