JSFiddle - React, Tailwind, and code Playground
by Ryan Perez
HTML
<div class="form-td">
<label for="CAT_Custom_73">Copy of Passport, Photo page(only for International students) (.zip)</label>
<br>
<input type="file" name="CAT_Custom_73" id="CAT_Custom_73" class="cat_textbox">
</div>
<div class="form-td">
<label for="CAT_Custom_73">Copy of Passport, Photo page(only for International students) (.zip)</label>
<br>
<input type="file" name="CAT_Custom_73" id="CAT_Custom_74" class="cat_textbox">
</div>
JavaScript
//select file
//look for change
function checkfilechange(selector) {
$(selector + ':file').change( function(e){
var ext = $(this).val().split('.').pop().toLowerCase();
if($.inArray(ext, [files]) == -1) {
alert("invalid extension! Please upload the following:" + files );
$(this).val("");
}
}
);
}
checkfilechange("#CAT_Custom_73");
checkfilechange("#CAT_Custom_74");