jquery - Toggle display of two divs on click of a link -


i have 2 divs in html 1 show embedded video youtube , other show contact-us input form. there link "contact us" above video.

initially when page loaded video displayed when user clicks on "contact us" link video should hidden , contact-us input form should displayed in place.

i'd using jquery.

use jquery's toggle() or of other methods show , hide <div>s.

here's simple example (http://jsfiddle.net/8wbxv/):

<div class="container">     <div class="video">         <a href="#">contact us</a><br />         video here     </div>     <div class="contact">         <a href="#">return video</a><br />         contact form here     </div> </div>  <script type="text/javascript"> $(document).ready(function () {     $('a').click(function () {         $('.container > div').toggle();     }); }); </script> 

this simple example. selector on link $('a') not you'd use, use here illustration.

have @ jquery api more details.


Comments