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' ); 

jsfiddle example

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.

  1. $('span').parent('p').css({ width:350px;height:250px;border:solid 5px #000;padding:5px;font-size:20px;}); overwrite rules above

  2. create class parent p , use .removeclass().


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -