JSFiddle - React, Tailwind, and code Playground

by Alex Alex

HTML

<form action="">
    <select>
        <option>Change me</option>
        <option>Im changed</option>
    </select><br>
    <input type="file" id="file-control"><br>
    <input type="submit" value="Submit" id="submit-control">
</form>

JavaScript

var submitNode = document.getElementById('submit-control');

document.getElementById('file-control').addEventListener('change', function () {
    //this will not fire in Opera Mini
    if (this.files[0]) {
        submitNode.value = 'Submit with photo';
    } else {
        submitNode.value = 'Submit';
    }
});

document.querySelector('select').addEventListener('change', function () {
    //this will work in Opera Mini and call after Opera Mini get changed page from Opera Mini server
    alert('Select was changed');
});