JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/additional-methods.js"></script>
<form id="test" action="test.html" method="post">
<input type="text" name="txtName" />
<input type="submit" name="btnSubmit" />
</form>
JavaScript
$(document).ready(function () {
ValidateForm();
});
function ValidateForm() {
$('#test').validate({
rules: {
"txtName": "required"
},
messages: {
"txtName": "this name is required for sure!"
},
errorPlacement: function (error, element) {
$(element).parent().append(error);
},
onfocusout: function (element) {
this.element(element);
}
});
}