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.
Asked
Active
Viewed 3.2k times
74
bonna
- 1,465
- 2
- 16
- 30
1 Answers
123
From the API documentation for attr
A null value will remove the specified attribute
So it looks like you want .attr('disabled', null).
diralik
- 5,155
- 3
- 25
- 48
Ian Roberts
- 117,925
- 15
- 163
- 179