jquery - Content toggling issue -
i want info hidden default , reveal when clicking on item. grabbed toggle script off net, reason it's doing opposite of want.
here's script goes between head tags:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").click(function(){ $("ul").toggle(); }); }); </script>
here's code in body:
<p class="toggle">+ apple ipad 2</p> <ul> <li>display screen (lcd) replacement - $99.99</li> <li>top glass (digitizer) replacement (black) – $109.99</li> <li>top glass (digitizer) replacement (white) – $109.99</li> </ul>
if please explain i'm doing wrong i'd appreciate it. thanks! :)
hide after loading page, toggle on click:
$(document).ready(function(){ $("ul").hide(); //added line $("p").click(function(){ $("ul").toggle(); }); });
Comments
Post a Comment