javascript - Dojo - removeClass by identifying div using class not working e.g. query('.lb').removeClass('hide'); -


this works:

query('#lb').removeclass('hide'); 

but need remove ".hide" class multiple divs tried this:

query('.lb').removeclass('hide'); 

i'm new dojo. i'm wondering why can select div remove class using id not class.

please help!

heres html i'm using

<div class="lb hide">         <div class="lbc">test</div>         <span class="closebtn">close</span>     </div>  <div id="lb" class="hide">         <div class="lbc">test</div>         <span class="closebtn">close</span>     </div> 

here's link jsfiddle of this: http://jsfiddle.net/7xh003o3/

there 2 divs, both ".hide" class. when link clicked, should both have ".hide" class removed , appear on screen. 1 id specified works.

your fiddle not have same code, in fiddle have:

query('.').removeclass('hide'); 

which should be:

query('.lb').removeclass('hide'); 

the code above should work fine. however, have 1 div .lb class on it. should change html both elements have .lb class, example:

<div class="lb hide">     <div class="lbc">test</div>     <span class="closebtn">close</span> </div>  <div id="lb" class="hide">     <div class="lbc">test</div>     <span class="closebtn">close</span> </div> 

if did that, should work fine, can see in updated fiddle: http://jsfiddle.net/7xh003o3/2/


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -