JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<form>
<input type='file' />
<input type='submit' value='submit'/>
</form>
<br/><br/>
<form>
<input type='text' />
<input type='submit' value='submit'/>
</form>
</body>
JavaScript
$(function(){
var jQBody = $('body');
// handler for forms with file uploads
jQBody.on('submit', 'form:has(input[type=file])', function(e){
e.preventDefault();
console.log('a file upload form!');
});
// all other forms
jQBody.on('submit', 'form:not(:has(input[type=file]))', function(e){
e.preventDefault();
console.log('a form with no uploads!');
return false;
});
});