How to remove an attribute in D3.js?

Is it possible to remove an attribute in D3.JS? I added it using .attr("disabled", "disabled") , and now I'm looking for something similar to jQuery .removeAttr("disabled", "disabled"); to remove it again. Useful for <button> and <option> . I tried using .remove() but it deletes the whole object, not the attribute.

+54
javascript dom attributes
Mar 10 '13 at 13:08
source share
1 answer

From the API documentation for attr

A null value will remove the specified attribute.

So it looks like you want .attr('disabled', null) .

+85
Mar 10 '13 at 13:15
source share



All Articles