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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -