tags:

views:

72

answers:

2

hi, 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

+7  A: 

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">
karim79
A: 

If I've understood your question you can do the following

$("tr").click(function () {
  //call funcion
});
skyfoot