JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.js"></script>
<form role="form" enctype="multipart/form-data" method="post" id="curso" action="R/rCurso.php">
<p class="text-muted">Los campos marcados con (<span style="color:red">*</span>) son obligatorios</p>
<div class="form-group">
<label>Curso <span style="color:red">*</span></label>
<input class="form-control" id="ccrs" name="crs" type="text" />
</div>
<button type="submit" id="save" class="btn btn-default">
Enviar
</button>
</form>
JavaScript
$(document).ready(inicio);
function inicio() {
$("#curso").validate({
onkeyup: function(element, event) {
if (event.which === 9 && this.elementValue(element) === "") {
return;
} else {
this.element(element);
}
},
rules: {
crs: { // <- must match the NAME!
required: true,
minlength: 10
}
},
messages: {
crs: { // <- must match the NAME!
required: "Please enter your firstname",
minlength: "el minimo es 10"
}
}
});
};