How to remove an attribute in D3.js?
Can I in D3.JS remove an attribute? I've added it using .attr("disabled", "disabled")
and now I am looking for something similar to jQuery's .removeAttr("disabled", "disabled");
to remove it again. Useful for <button>
and <option>
. I've tried using the .remove()
but that removes the entire object not the attribute.
Solution 1:
From the API documentation for attr
A null value will remove the specified attribute
So it looks like you want .attr('disabled', null)
.