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

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

I have the following HTML in a JSP file:

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-25 11:15

    Unless otherwise definied (

, ), browsers put implicitly in a .

You need to put a > tbody in between > table and > tr:

$("div.custList > table > tbody > tr")

Alternatively, you can also be less strict in selecting the rows (the > denotes the immediate child):

$("div.custList table tr")

That said, you can get the immediate

children there by $(this).children('td').

提交回复
热议问题