javascript - Stumped on simple Jquery code -



javascript - Stumped on simple Jquery code -

i have been stuck hours trying different ways of implementing it. don't understand why wont work. trying toggle ul between show/hide whenever button clicked, not work. here relevant code:

in head:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

the code:

<script> jquery(document).ready(function(){ jquery('.active-stream').live('click', function(event) { jquery('.feed-list').toggle('show'); }); }); </script> <button type="button" class="active-stream">click me!</button> <ul class="feed-list"> <li>feed 1</li> <li>feed 2</li> </ul>

.live() deprecated of 1.7 , removed of 1.9. utilize on() instead..

working demo utilize this,

jquery(document).ready(function(){ jquery(document).on('click','.active-stream', function(event) { jquery('.feed-list').toggle('slow'); //use 'slow' }); });

also, add together functionality of .live(), need utilize delegation (only if adding elements dynamically.)

javascript jquery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -