How to bind events inside the module?

(function ($){
 function close(){
console.log("close");
}

 $("some element"page).on("click", close));
}(jQuery));

How it can be implemented?
August 19th 19 at 23:24
1 answer
August 19th 19 at 23:26
Solution
In a nutshell, something like this
( function ( $ ) {
 $.fn.MyModule = function () {
 $( this ).on( 'click', function () {
console.log("close");
 } );
}
} )( jQuery );


And called so
$( '.element' ).MyModule();

It's all in very General terms.

Find more questions by tags JavaScriptjQuery