JSFiddle - React, Tailwind, and code Playground
HTML
<p>Make me alert "Hello!"</p>
<button>Test</button>
JavaScript
var MyObject = {
testValue: "Hello!",
testFunction: function() {
alert(this.testValue);
},
init: function(button) {
button.click(testFunction());
}
}
var buttonInstance = new MyObject;
var button = $('button');
buttonInstance.init(button);