[英]How to remove an attribute in D3.js?
Can I in D3.JS remove an attribute? 我可以在D3.JS中删除属性吗? I've added it using .attr("disabled", "disabled")
and now I am looking for something similar to jQuery's .removeAttr("disabled", "disabled");
我使用.attr("disabled", "disabled")
添加它,现在我正在寻找类似于jQuery的.removeAttr("disabled", "disabled");
to remove it again. 再次删除它。 Useful for <button>
and <option>
. 对<button>
和<option>
有用。 I've tried using the .remove()
but that removes the entire object not the attribute. 我尝试过使用.remove()
但删除整个对象而不是属性。
From the API documentation for attr
来自attr
的API文档
A null value will remove the specified attribute 空值将删除指定的属性
So it looks like you want .attr('disabled', null)
. 所以看起来你想要.attr('disabled', null)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.