jquery - Issue targeting div after creating it with .wrap() -


i'm having strange issue checking whether div created .wrap() visible or not. i'm wrapping divs , using id's on them targets. i've tested make sure click registering alert(), , is.

here code.

//leftbar jquery $('ul.leftnav').wrap('<div id="leftnav-wrap" class="five columns alpha" />'); $('#leftnav-wrap').prepend('<div class="arrow" />'); $('#content').has('#leftnav-wrap').find('#page').wrap('<div class="eleven columns omega" />');  //mobile leftbar $('h4.mobile.toggle').click(function(){     if ($('#leftnav-wrap').is(':hidden')){         $(this).addclass('active');         $('#leftnav-wrap').addclass('active');     }     else{         $(this).removeclass('active');         $('#leftnav-wrap').removeclass('active');     } }); 

is there inherently wrong i've coded? doesn't toggle of active classes suppose to, , have site working fine, it's not targeting id created .wrap()

so, here issue. couldn't find hidden div add class to, , couldn't find visible div remove class from. clicking did nothing.

i had preemptively hide leftnav css, , add class .active state displays again. then, toggling works fine...

whoops!

fixed jsfiddle here: http://jsfiddle.net/zd7hz/1/


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -