JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<form action="" method="post" id="input">
<input type="submit">
</form>
</div>
JavaScript
$(function() {
$("#container").css("background", "red");
var ReserveUI = function($el) {
this.$form = {
input: $el.find('#input')
};
this._eventify();
};
ReserveUI.prototype.doSomething = function() {
return false;
}
ReserveUI.prototype._eventify = function() {
this.$form.input.submit(function() {
this.doSomething(); //if comment out this line, it works
return false;
});
};
var UI = new ReserveUI($("#container"));
});