Let’s say we have an HTML table, like below:
Now, let’s add click event to this.
Let’s say when a user clicks, we want to display the row number they are clicking on. Add a reference to jquery, and then add the code for the click event of the table row:
Clicking on NY produces:
Note the table is 0-index based, and there is also a row for the heading.
Now let’s change this to double click. We just need to change the click event to dblclick:
Clicking on TX produces: