jquery - is not a function error

后端 未结 7 456
傲寒
傲寒 2020-11-30 02:06

Here is my code:

(function($){
    $.fn.pluginbutton = function (options) {
        myoptions = $.extend({ left: true });
        return this.each(function (         


        
7条回答
  •  迷失自我
    2020-11-30 03:01

    This problem is "best" solved by using an anonymous function to pass-in the jQuery object thusly:

    The Anonymous Function Looks Like:

    
    

    This is JavaScript's method of implementing (poor man's) 'Dependency Injection' when used alongside things like the 'Module Pattern'.

    So Your Code Would Look Like:
    Of course, you might want to make some changes to your internal code now, but you get the idea.

    
    

提交回复
热议问题