Open link when doubleclicking on table row with jQuery

double-click, html, javascript, jquery

Solution

Do you have any jQuery you've written yet? Here's a headstart...

Define your ID in the row:

<tr id="something">...</tr>

Then use something like this:

$('tr').dblclick(function(){
  var id = $(this).attr('id');
  //do something with id
})

Problem

I have a `table` that looks like this: ``` <table id="table"> <thead> <tr class='tablehead'> <th>Test</th> </tr> </thead> <tbody> <tr class='tablecell'> <td> </td> </tr> </tbody> </table> ``` - I want to be able to double click on a row and then trigger a link. - An ID has to be transmitted somehow. Where should I define this? This allows me to edit the selected row afterwards. Any idea how to do this?

Original source