JSFiddle - React, Tailwind, and code Playground

by huu nguyen

HTML

<input placeholder="edit me">
<p></p>
<input placeholder="edit me rrr">

JavaScript

$.event.special.inputchange = {
    setup: function() {
        var self = this, val;
        $.data(this, 'timer', window.setInterval(function() {
            val = self.value;
            if ( $.data( self, 'cache') != val ) {
                $.data( self, 'cache', val );
                $( self ).trigger( 'inputchange' );
            }
        }, 20));
    },
    teardown: function() {
        window.clearInterval( $.data(this, 'timer') );
    },
    add: function() {
        $.data(this, 'cache', this.value);
    }
};

$('input').on('inputchange', function() {
    $('p').text(this.value);
});