How do i bind the "contextmenu"(it is a Plugin for the Context menu) to every first td in every row
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.
精彩评论