javascript - want to show and hide div with jquery -
i new jquery, , don't understand 100%. want div containing text or image, , when click on it, show div.
html:
<div class="mytrigger">click here</div> <div class="mycontent">show when clicking on above</div>
jquery:
<script> $( ".mytrigger" ).click(function() { $( ".mycontent" ).toggle( "slow", function() { }); }); </script>
so, when click on "mytrigger", must show "mycontent.
just leave function inside toggle-call away:
$(function() { $( ".mytrigger" ).click(function() { $(".mycontent").toggle("slow"); }); });
see: http://jsfiddle.net/a8np4/3/
edit: wrapped in dom-ready-call
Comments
Post a Comment