Reputation: 2944
I have a javascript function..
<script type="text/javascript">
var RowClick = function() {
$("#mytable").click(
$("#showgrid").load('/Products/List/Items/'));
};
</script>
Can I call this function on onclick event on tr? I am calling something like this?
<tr class="something" onclick="javascript:RowClick()');">
can i call like this? if I call its not loading the URL?
can anybody help me out?
thanks
Upvotes: 5
Views: 10523
Reputation: 342635
There is no need to call RowClick()
inline. Just put that code into a click event handler and attach it to each row:
$(document).ready(function() {
$("#mytable tr.something").click(function() {
$("#showgrid").load('/Products/List/Items/'));
});
});
<tr class="something">
Upvotes: 11
Reputation: 20769
If I've understood your question you can do the following
$("tr").click(function () {
//call funcion
});
Upvotes: 0