I was checking a few sites, and I came up with the below:
<table class="admin_table">
<thead>
<tr>
<th>Company Name</th>
<th>Industry</th>
</tr>
</thead>
<tbody>
<tr url="/home/companies/1">
<td>Microsoft</td>
<td>Computer Software</td>
</tr>
</tbody>
</table>
$(document).ready(function() {
$(".admin_table tr").not(':first').click(function() {
var url = $(this)..attr("url");
if (url != null && url != '') {
window.location = url;
}
});
});
However, when clicking on the row, it’s not responding?
I initially read the following sites for this:
jQuery – Click event on <tr> elements with in a table and getting <td> element values
http://www.electrictoolbox.com/jquey-make-entire-table-row-clickable/
Is there anything I am missing in my code? In many cases the code is identical…
Ofcourse only the second row should work, since that is the one with the url. But first you should remove the double dots
$(this).attr(‘url’);