i have the table of rows which are dynamic in nature from server side script (PHP)
so each and every first td in the row of every table will have the context menu
(jquery plugin) applied .
How do i get the attribute id(which is dynamic in nature) of
when ever the
first item of context menu is clicked
$("#mytable td:first-child").contextMenu("myMenu1",{
bindings: {
'hdr': function(t) {
alert($(this).closest("td").find("a").attr("id"));
}
},
menuStyle: {
border: '1px solid #000'
}
});
But my problem from the above code it is returning same id called “test0” for each and every row .
But my also goal is to get the value of data-value1 (dynamic) for a href tag on each row
when ever the first menu item is clicked in the contextmenu
According to the docs:
So you have a parameter
tthat should refer to the element you clicked in order to get the context menu.Try this: