How to create and cause JQuery



  • Figured a function similar to JQuery.toggle() I'm calling her for a paragraph, but somehow nothing happens. The normal function that is commented is working.

    $(document).ready(function() {
    $("button").click(function() {
        $("p").inOut("p");
        //inOut("p");
    });
    });
    

    /function inOut(el) {
    $(el).animate({
    height: "toggle"
    }, 500);
    }
    /

    (function($) {
    $.fn.inOut = function(el) {
    $(el).animate({
    height: "toggle"
    }, 500);
    };
    })(JQuery);



  • (function($) {
     $.fn.inOut = function(el) {
        $(el).animate({
            height: "toggle"
        }, 500);
     };
    })(jQuery);
    

    jQuery, not Jquery. The register is important.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2