I have a table in my MVC application. I want to get the id of the selected row. I captured the tr click event using jQuery. An example table is shown below.
<table id="resultTable"> <tr id="first"> <td>c1</td> <td>c2</td> </tr> <tr id="second"> <td>c3</td> <td>c4</td> </tr> </table>
I use the following script to access the event with a mouse click
$(document).ready(function () { $('#resultTable tr').click(function (event) { alert(this.);
But its not working. How to get the selected row id. Any ideas?
jquery html
Null pointer
source share