开发者

how to call the javascript function on table row click

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


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">


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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜