JSFiddle - React, Tailwind, and code Playground
by Narendra Lakhtariya
HTML
<form action='portal-files/user-file-upload.php' method='post' enctype='multipart/form-data'>
<input type='hidden' name='MAX_FILE_SIZE' value='100000' />
<input type='hidden' name='admin_id' value='0' />
<select name='id' id='form-option' class='test-only'>
<option selected="selected" value="">Choose a User</option>
<option value="1">User 1 </option>
</select>
<input name='uploadedfile' type='file' id='custom-file-input' class='test-only'/> <br/>
<input type="submit" name="submit" value="Upload" id="custom-submit-input" disabled="disabled" />
</form>
JavaScript
jQuery(document).ready(function() {
jQuery('.test-only').on('keyup change', function(){
if (jQuery('#form-option').val() == '') {
jQuery('#custom-submit-input').prop('disabled', true);
} else {
jQuery('#custom-submit-input').prop('disabled', false);
}
});
});