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.4k times
77

bonna
- 1,575
- 2
- 17
- 31
1 Answers
131
From the API documentation for attr
A null value will remove the specified attribute
So it looks like you want .attr('disabled', null)
.

diralik
- 6,391
- 3
- 28
- 52

Ian Roberts
- 120,891
- 16
- 170
- 183