How to get two slidetoggle working with JQuery -


basically want piece of code toggle multiple pieces of code whenever they're clicked ,now i'm new jquery , can't seem working .any bit of great

<script>  $(document).ready(function () {     $("#flip").click(function () {         $("#panel").slidetoggle("1000");     }); }); </script> 

above script,and below code want have effect.

        <div class = "description">          <div id="flip">                  dog says how ?                 <div id="panel">hidden text</div>            </div>                  <div id="flip">                  dog says how ?                 <div id="panel">more hidden text</div>          </div> 

the first "panel" work second dormant.

id should unique, need use class instead:

<div class="flip">     dog says how ?     <div class="panel">hidden text</div>    </div> 

then can do:

$(".flip").click(function(){     $(this).find(".panel").slidetoggle("1000"); }); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -