JSFiddle - React, Tailwind, and code Playground

HTML

<form action="" id="myform">
    <input type="submit" />
</form>
<div id="output"></div>

JavaScript

function Form(x) {
  this.x = x;
  $("#myform").on("submit", this.echoX.bind(this));
}
Form.prototype.echoX=function() {
  var $log = $("#output");
  $log.html($log.html() + this.x + "<br>");
  return false;
}

var form1 = new Form(5);
form1.echoX();
var form2 = new Form(10);
form2.echoX();