JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="teste" />
<input type="button" onclick="selecionarTexto();" value="OK" />
<input type="button" id="clickme" value="Click me" />
<script>
    function selecionarTexto() {
        $("#teste").val(Math.random());
    }
    var jVal = $.fn.val;
    $.fn.val = function(v) {
        if (typeof v != 'undefined') jVal.call(this, v);
        else return jVal.call(this);
        if (v) $(this).trigger('change');
    }
</script>

JavaScript

$("#teste").on("change blur", function () {
    console.log(this, this.value);
    alert($(this).val());
});

$("#clickme").bind("click",function(){
    $('#teste').val("asdasd");
});