JSFiddle - React, Tailwind, and code Playground
JavaScript
var foo = (function(){
// private function
function doSomething() {
// METHOD WHICH I WILL MANIPULATE THIS.ELEMENT
alert('doSomething()');
}
var myObject = {
init: function() {
this.message = 'hello init';
this.element = $('.someElement');
this.element.on('click', function() { doSomething.call(this); }.bind(this));
alert(this.message);
}
};
return myObject;
})();
foo.init();