jquery - Remove css style from element -
i remove parent styling added css stylesheet using jquery. googled can find removing inline styles or classes
html
<p><span>text</span></p>
css
p{ width:300px; height:200px; border:solid 3px #000; padding:10px; font-size:23px; } span{ width:100%; height:100%; background: #ccc; padding:10px; }
i tried many jquery variations, 1 of them:
$('span').parent().removeattr( 'style' );
you can not removeattribute
p
because there no inline css or style
attribute set p
tag.
you can overwrite default css using .css()
what can do.
$('span').parent('p').css({ width:350px;height:250px;border:solid 5px #000;padding:5px;font-size:20px;});
overwrite rules abovecreate
class
parentp
, use.removeclass()
.
Comments
Post a Comment