JSFiddle - React, Tailwind, and code Playground
by vandanasrivastava
HTML
<form action='portal-files/user-file-upload.php' method='post' enctype='multipart/form-data'>
<input name='uploadedfile' type='file' id='custom-file-input' class='test-only'/> <br/>
<input type="text" class="test-only"/> <br/>
<input type="text" class="test-only"/> <br/>
<input type="text" class="test-only"/> <br/>
<input type="text" class="test-only"/> <br/>
<select name='id' id='form-option' class='test-only'>
<option value="">Select Option</option>
<option value="1">One</option>
<option value="2">Two</option>
</select><br>
<input type="submit" name="submit" value="Upload" id="custom-submit-input" disabled="disabled">
</form>
JavaScript
jQuery('.test-only').on('keyup change', function() {
var flag = false;
$('.test-only').each(function() {
if($(this).val()=="") {
flag = true;
return false;
}
});
jQuery('#custom-submit-input').prop('disabled', flag);
});