JSFiddle - React, Tailwind, and code Playground

by Daniel Lamb

HTML

<form>
    <button type="submit">Submit form</button>
    form submit count <span>0</span>
</form>

JavaScript

$('form').on('submit', function (e) {
    // look up count element
    var elm = $('span'),
        // parse the current value
        count = parseInt(elm.text(), 10);
    // increment the count
    count++;
    // update the view
    elm.text(count);
    // disable submitting the page
    e.preventDefault();
});