JSFiddle - React, Tailwind, and code Playground

by sanpopo

HTML

<input id="fileToUpload" type="file" name="fileToUpload" />

JavaScript

//delegate event to input type file on document ready

$(document).ready(function () {    
    addEventToBrowseFileBtn();
    alert('event was bound');
});

function addEventToBrowseFileBtn() {
        $('#fileToUpload').on('change', function () {
            if ($('#fileToUpload').val() == "") {
                return false;
            }
            alert('doing some code stuff');
        });
    };