开发者

How do i bind the "contextmenu"(it is a Plugin for the Context menu) to every first td in every row

开发者 https://www.devze.com 2023-01-13 20:08 出处:网络
iam having the table with id \"someTable\" where i have the rows dynamically from PHP i want to apply the contextmenu to every first td in every row .iam using the

iam having the table with id "someTable" where i have the rows dynamically from PHP i want to apply the contextmenu to every first td in every row .iam using the context menu plugin from here (http://www.trendskitchens.co.nz/j开发者_如何学Pythonquery/contextmenu/)

        $("someTable td").contextmenu('mymenu')(function (){

    //would the above statement work
     });    


Use :first-child:

$("#someTable td:first-child")

:first-child will select all matching elements (the tds) that are the first child of their parent (the tr).


Use the nth-child selector like this:

$("someTable td:nth-child(1)")

That will target every first td of the row.

0

精彩评论

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