Here is the code that I’m trying to convert:
<script>
function fsomething(rowid) {
window.location = "/somewhere/" + rowid;
}
</script>
<tr>
<td>
<button onClick="fsomething('{{rowid}}')">row 1L</button>
</td>
<td>
<button onClick="fsomething('{{rowid}}')">row 2L</button>
</td>
</tr>
How can I convert this to:
$('button').click(function() { .... } );
where {{rowid}} is dynamically generated, and unique to each row?
If you store the id using a
data-attribute then you can get that out of the element when it is clicked.