Possible Duplicates:
php regexp: remove all attributes from an html tag Remove style attribute from HTML tags
EDITED:
For example i am having the following content:
<div style="text-indent: -76.5pt; margin: 0in 54.9pt 0pt 76.5pt;"><strong>Motion with Constant Acceleration</strong></div>
I need to remove all s开发者_开发问答tyle attributes using jQuery and PHP
My output should look like this:
<div style=""><strong>Motion with Constant Acceleration</strong></div>
OR
<div><strong>Motion with Constant Acceleration</strong></div>
How can this be done.. Any help will be thankful and grateful...
Thanks in advance...
jQuery option would be
$('*[style]').attr('style', '');
// sets style attribute to empty string on all elements that have it
PHP is referred in comments
Use not selector to exclude table
$("*[style]").not("table").removeAttr("style");
or
$("*[style]").not("table").attr("style", "");
精彩评论