JSFiddle - React, Tailwind, and code Playground
by bizamajig
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.js"></script>
<form id="myform" action="myaction.asp" method="get">
<input type="text" id="name" name="name" /><br/>
<input type="email" id="email" name="email" /><br/>
<input type="submit" id="submit" class="hide" />
</form>
CSS
.hide {
display: none;
}
JavaScript
$(document).ready(function() {
$('#myform input, #myform select, #myform textarea').on('oninput change keydown paste input blur', function( e ) { // keyup - not required here
console.log(e.target);
if ( $("#myform").valid() ) {
// $('#submit').prop('disabled', false);
console.log( 'show');
$('#submit').show();
}
else {
// $('#submit').prop('disabled', 'disabled');
console.log( 'hide');
$('#submit').hide();
}
});
$("#myform").validate({
rules: {
name: {
required: true,
minlength: 4
},
email: {
required: true,
email: true
}
}
});
});