0

I'm just learning to create jQuery plugin. But I'm getting error in my initial effort. I did refer here, jquery - is not a function error but it seems like my code is similar to that. But what causing the above error?

//invoking the function like in app.js

jQuery(function(){
  jQuery('body').testapp();
});

//defining the plugin in app.jquery.js

jQuery.noConflict();
(function($){
    $.fn.testapp = function(){
        return $(this).append('<h1>success</h1>');
    };
})(jQuery);

error getting in chrome console:

****app.js:2 Uncaught TypeError: jQuery(...).testapp is not a function****
Community
  • 1
  • 1
112233
  • 2,406
  • 3
  • 38
  • 88

0 Answers0