If you do not want to completely turn off text selection (which is usually much better for the user), you can manually deselect an item using selectSubString .
.on("dblclick", function(d) { toggle(d); update(d); var text = d3.select(this).select("text")[0][0] text.selectSubString(0,0) });
But this does not work with a cross browser yet, since the SVG API is not yet fully implemented in many cases. (It works at least in Chrome)
The best way to cross-browser is to simply rewrite the text. Usually this also kills the choice:
g.on("dblclick", function(d) { toggle(d); update(d); var text = d3.select(this).select("text") var value = text.text() text.text(value) })
This worked in Firefox and Chrome at least.
source share