jQuery - Click event on elements with in a table and getting element values

后端 未结 7 1159
说谎
说谎 2020-12-25 10:48

I have the following HTML in a JSP file:

相关标签:
7条回答
  • 2020-12-25 11:41

    Try jQuery's delegate() function, like so:

    $(document).ready(function(){
        $("div.custList table").delegate('tr', 'click', function() {
            alert("You clicked my <tr>!");
            //get <td> element values here!!??
        });
    });
    

    A delegate works in the same way as live() except that live() cannot be applied to chained items, whereas delegate() allows you to specify an element within an element to act on.

    0 讨论(0)
提交回复
热议问题