I'm working on a jQuery plugin. It's my first, so I apologize if this is a dumb question.
I have several public methods within the plugin.
I'm trying to call these methods from within the plugin definition AND outside the plugin in a similar way to how the public
keyword works in Java for methods, but I keep getting undefined is not a function
errors.
I've tried calling it several ways, but still can't get it to work.
Any ideas on how to do this?
Here's an example of my codebase:
$(document).ready(function() {
(function($) {
// Plugin Definition
$.fn.popup = function(options){
// code here...
// SUBMIT FORM
$(settings.popupSubmitSelector).on("click", function(e) {
submitForm(); // call to my method
this.submitForm();
$.fn.popup.submitForm();
});
// more code here...
// my public method
this.submitForm = function(){
// method code here
}
// more code...
}
}(jQuery));
});