How do you remove a handler using a d3.js selector
Found out that although .off()
is not supported for d3 v2.9.1, an alternative is.on('click',null)
Fully:
add_listeners = function() { // Remove handler before adding, to avoid superfluous handlers on elements. d3.selectAll(".nodes").on('click',null); d3.selectAll(".nodes").on("click", function() { //Event handler });}
Reference: