如何从html中删除标记样式

时间:2015-06-26 13:40:50

标签: javascript jquery html

如何从数据变量中的html中删除style =“”?

<span>
    <a href="#/posts/{{$index|angular}}">Comments</a>
</span>

1 个答案:

答案 0 :(得分:1)

你应该通过克隆 var $clone = $('.fc-content').clone(); // Clone the element $clone.find("[style]") // Find the elements with style attributes .removeAttr("style") // Remove the attribute entirely var data = .html(); // Now grab the clone's HTML 来做到这一点 - 这样你就可以使用jQuery来执行操作:

<div id="demo"></div>