JSFiddle - React, Tailwind, and code Playground
HTML
<div id="msgErros"></div>
<form>
<label for="dataInicial">Data Inicial</label>
<input type="text" name="filtro.dataInicial" id="dataInicial" class="datas" data-rule-min="1" />
<label for="dataFinal">Data Final</label>
<input type="text" name="filtro.dataFinal" id="dataFinal" class="datas" data-rule-min="1" />
<br />
<label for="tempoInicial">Tempo Inicial</label>
<input type="text" name="filtro.tempoInicial" id="tempoInicial" class="tempos" />
<label for="tempoFinal">Tempo Final</label>
<input type="text" name="filtro.tempoFinal" id="tempoFinal" class="tempos" />
<br />
<button type="submit">Enviar</button>
</form>
JavaScript
/*!
* jQuery Validation Plugin 1.11.1
*
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
* http://docs.jquery.com/Plugins/Validation
*
* Copyright 2013 Jörn Zaefferer
* Released under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
$.extend($.fn, {
// http://docs.jquery.com/Plugins/Validation/validate
validate: function( options ) {
// if nothing is selected, return nothing; can't chain anyway
if ( !this.length ) {
if ( options && options.debug && window.console ) {
console.warn( "Nothing selected, can't validate, returning nothing." );
}
return;
}
// check if a validator for this form was already created
var validator = $.data( this[0], "validator" );
if ( validator ) {
return validator;
}
// Add novalidate tag if HTML5.
this.attr( "novalidate", "novalidate" );
validator = new $.validator( options, this[0] );
$.data( this[0], "validator", validator );
if ( validator.settings.onsubmit ) {
this.validateDelegate( ":submit", "click", function( event ) {
if ( validator.settings.submitHandler ) {
validator.submitButton = event.target;
}
// allow suppressing validation by adding a cancel class to the submit button
if ( $(event.target).hasClass("cancel") ) {
validator.cancelSubmit = true;
}
// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
if ( $(event.target).attr("formnovalidate") !== undefined ) {
validator.cancelSubmit = true;
}
});
// validate the form on submit
this.submit( function( event ) {
if ( validator.settings.debug ) {
// prevent form submit to be able to see console output
event.preventDefault();
}
function handle() {
var hidden;
if ( validator.settings.submitHandler ) {
if ( validator.submitButton ) {
// insert a hidden input as a replacement for the missing submit button
hidden =...