JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<body>
<input type="button" id="myButton" value="Click me!" />
</body>
</html>
JavaScript
function MyClass(text) {
this.text = text;
$('#myButton').click(this.button_click);
}
MyClass.prototype.showText = function() {
alert(this.text);
};
MyClass.prototype.button_click = function() {
this.showText();
};
$(document).ready(function() {
var c = new MyClass('Hey there');
});