javascript - remove all of a class in a div -


in outer div want remove classes testclass not working.

http://jsfiddle.net/taczj/

jquery

$('#outer').removeclass('testclass'); 

html

 <span class="testclass">d</span>  <span class="testclass">d</span>  <span class="testclass">d</span>  <span class="testclass">d</span>  <div id="outer">     <span class="testclass">d</span>     <span class="testclass">d</span>     <span class="c">d</span>     <span class="testclass">d</span>     <span class="testclass">d</span>     <span class="testclass">d</span>     <span class="c">d</span>     <span class="testclass">d</span>     <span class="testclass">d</span>     <span class="testclass">d</span> </div> 

css

.testclass{color:red;}  .c{ color:blue;} 

$('#outer > .testclass').removeclass('testclass'); 

you're selecting wrapper div, not children spans class. argue against other answers, since selecting more elements necessary.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -