JSFiddle - React, Tailwind, and code Playground

by chovy

HTML

<form>
    <input type="text" name="foo" id="foo">
    <button type="reset">clear</button>
</form>

JavaScript

var o = {
    init: function(){
        $("#foo").on('input.foo', function(e){
            console.log(this.value);
        });
        
        $("button").on('click.foo', function(e){
            this.reset(e);
        }.bind(this));
    },
    
    reset: function(e){
        console.log('reset');
    }
};

o.init();