I am using jQuery context menu plugin by Chris Domigan to appy a context menu. This is how I do it:
$('#contacts tbody tr').contextMenu('myMenu1', {
bindings: {
'copy': function(t) {
alert('Trigger was '+t.id+'\nAction was Copy');
},
'delete': function(t) {
alert('Trigger was '+t.id+'\nAction was Delete');
}
},
});
My question is, how do I get the content of the clicked tr item? I tried with
$(t.target).html()
but it returns null. Any idea?
EDIT: here is the example http://jsfiddle.net/gqhRV/
not familiar with the plugin, but from the looks of it you should be able to write:
but in the case of most jQuery plugins you should be able to do this:
from within the context of the
'copy': function(t) {and'delete': function(t) {Here’s a working example: http://jsfiddle.net/dNUgg/
I’m guessing your
<tr>tags do not have anidattributeEven when the
<tr>does not have an ID this still works: http://jsfiddle.net/dNUgg/1/updated your jsfiddle: http://jsfiddle.net/gqhRV/1/
you were doing
$(t.target).text()when you should be doing$(t).text()