jquery - Delete and add nodes with click on a node in d3.js -


how add or remove nodes , links onclick event in code?

here (d3js) code fiddle.

how use: right click on node , click on delete remove nodes no link.
want remove 1 node , it's links click delete.

//right click menu items $('g.node').contextmenu('cntxtmenu', {     itemstyle:     {         fontfamily : 'arial',         fontsize: '13px'     },     bindings:     {         'open': function(t) {             alert(t.__data__.name);         },         'email': function(t) {             alert('trigger '+t.__data__.name+'\naction email');         },         'save': function(t) {             alert('trigger '+t.__data__.name+'\naction save');         },         'delete': function(t) {             $('g.node').remove();             //alert('trigger '+t.__data__.name+'\naction delete');         }     } }); 

just use $(t) instead of $('g.node')

   'delete': function(t) {         $(t).remove();      } 

see demo here


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -