Passing arguments and values form HTML to jQuery (events)
Posted
by Jaroslav Moravec
on Stack Overflow
See other posts from Stack Overflow
or by Jaroslav Moravec
Published on 2010-05-25T13:31:13Z
Indexed on
2010/05/25
13:41 UTC
Read the original article
Hit count: 292
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.
© Stack Overflow or respective owner