Jquery dynamic slideToggle with plugin method - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:slideToggle

Description

Jquery dynamic slideToggle with plugin method

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://code.jquery.com/jquery-1.8.2.min.js"></script> 
  <script>
$(document).ready(function(){
    (function($){//  ww w  . jav  a 2  s  .  c om
        $.fn.collapse = function(){
            $(this).slideToggle();
        };
    })(jQuery);
});

      </script> 
 </head> 
 <body> 
  <h3> <a href"javascript:void(0)" onclick="$('div#itemid').collapse()">$Title</a> </h3> 
  <div id="itemid">
    test 
  </div>  
 </body>
</html>

Related Tutorials