Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何从标记中删除样式属性?_Javascript_Html - Fatal编程技术网

Javascript 如何从标记中删除样式属性?

Javascript 如何从标记中删除样式属性?,javascript,html,Javascript,Html,我正在创建一个网站的移动版本,为了让它正常工作,我需要删除页面上某些标签的“样式”属性 例如: <div class="gallery-arrows" style="top:85px;"></div><h8 style="top:85px;"><a href="https://twitter.com/TeamTHCRacing" style="color:#ffffff;">THC Racing on Twitter!</a><

我正在创建一个网站的移动版本,为了让它正常工作,我需要删除页面上某些标签的“样式”属性

例如:

 <div class="gallery-arrows" style="top:85px;"></div><h8 style="top:85px;"><a href="https://twitter.com/TeamTHCRacing" style="color:#ffffff;">THC Racing on Twitter!</a></h8>

我需要:

 <div class="gallery-arrows"></div><h8><a href="https://twitter.com/TeamTHCRacing" style="color:#ffffff;">THC Racing on Twitter!</a></h8>

我可以添加一些东西来删除它们吗?像剧本什么的


谢谢

使用jquery很简单:

$('div,h8,a').removeAttr("style");

请参阅不仅仅是
$('[style]')。removeAttr(“style”)
?问题是“某些标记”。因此我提到了标记,否则您的方法非常好。工作非常好,谢谢