testfunction() not added to the jQuery function stack.
If you want to be able to call it on an arbitrary object, you must add it to the jQuery function stack:
$.fn.testfunction = function() {
this.addClass('testing');
};
$('.tester').testfunction();
You should look at the jQuery Plugins / Authoring page for more information on how to write plugins correctly.
source
share