html - Show/Hide element with jquery -
i have element (div),
named: element1, element2, element3
by default : element1 visible, element2 visible, element3 hidden
here code use
<script type="text/javascript"> $(document).ready(function () { $('#element3').hide(); $('#element1').click(function () { $('#element3').toggle(400); }); }); </script>
i use code above make element3 visible when click on element1.
my question
how make element2 hidden , element 3 visible when click on element1?
how can revert default after click again in element1?
try
$(document).ready(function () { $('#element3').hide(); $('#element1').click(function () { $('#element3').toggle(400); $('#element2').toggle(400); }); });
demo: fiddle
Comments
Post a Comment