How to create custom JQuery function and how to use it?

后端 未结 6 1600
一向
一向 2020-12-14 15:16

I\'m searching for information about that - \"How to create custom (own) JQuery function and how to use it\"

I\'ve searched in Google, but I didn\'t found informatio

6条回答
  •  情话喂你
    2020-12-14 15:44

    you can use it like this

      $(document).ready(function() {
            $('#button').click(function(){
                $(this).myFunction();
             });
             $.fn.myFunction = function() { 
                alert('test'); 
             }
        });
    

提交回复
热议问题