我有以下HTML结构=>
<span style="font-size:13px;">
<div style="margin-top:14pt;margin-bottom:1em;"><br>
<font size="1"><span style="font-size:12px;"><b>Name:</b></span></font><font size="1"><span style="font-size:12px;"> pratikJj jj</span></font></div>
<div style="margin-top:14pt;margin-bottom:1em;"><font size="1"><span style="font-size:12px;"><b>Email:</b> <a target="_blank" href="redir.aspx?C=AqQ9qrS3S0CCUr8wYx3QUu0HmT-cF9EI3kjBzIy3J26HoWKecGaL2VVHKtRt0q8meK1S8kDowtw.&URL=mailto%3apratik.joshi%40aressindia.net">pratik.joshi@aressindia.net</a></span></font></div>
<div style="margin-top:14pt;margin-bottom:1em;"><font size="1"><span style="font-size:12px;"><b>Phone Number:</b></span></font><font size="1"><span style="font-size:12px;"> 919999999999</span></font></div>
<div style="margin-top:14pt;margin-bottom:1em;"><font size="1"><span style="font-size:12px;"><b>Name Of Facility:</b> sdsd</span></font></div>
<div style="margin-top:14pt;margin-bottom:1em;"><font size="1"><span style="font-size:12px;"> </span></font></div>
</span>
这就是我想做的事情=&gt;
如果div包含以下样式
margin-top:14pt;margin-bottom:1em;
然后样式应为空白或例如style =&#34;&#34;
答案 0 :(得分:7)
尝试使用attribute contains selector,
$('div[style*="margin-top:14pt;margin-bottom:1em;"]').removeAttr("style");
答案 1 :(得分:0)
如果你在div上有课程会更容易(更清洁)吗?
然后基本上适应Rajaprabhu提供的相同答案:
$(".className").removeAttr('style');
答案 2 :(得分:0)
答案 3 :(得分:0)
如上所述,我会从HTML标记中移动所有样式,而不是将它们放入CSS中。然后利用JavaScript / jQuery选择器。
另请注意:HTML5不支持<font>
标记。