function validate() { var valid = true; if($('#senderNameBox')[0].checkValidity() && $('#senderEmailBox')[0].checkValidity() && $('#messageBox')[0].checkValidity()) { $('#submitButton').prop('disabled', false); } else { $('#submitButton').prop('disabled', true); } } $(function() { var form = $('#theContactForm'); H5F.setup([form[0]], { validClass: 'valid', invalidClass: 'invalid', requiredClass: 'required' }); $.each([$('#senderNameBox'), $('#senderEmailBox'), $('#messageBox')], function(i,o) { $(o).keyup(validate) }); });