Passing arguments and values form HTML to jQuery (events)
- by Jaroslav Moravec
What is the practice to pass arguments from HTML to jQuery events function.
For example getting id of row from db:
<tr class="jq_killMe" id="thisItemId-id">
...
</tr>
and jQuery:
$(".jq_killMe").click(function () {
var tmp = $(this).attr('id).split("-");
var id = tmp[0]
// ...
}
What's the best practise, if I want to pass more than one argument?
Is it better not to use jQuery? For example:
<tr onclick="killMe('id')">
...
</tr>
I didn't find the answer on my question, I will be glad even for links.
Thanks.