JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"></script>
<form id="myform" action="post.php">
<input type="text" name="first_name" />
<br/>
<input type="text" name="last_name" />
<br/>
<input type="text" name="phone" />
<br/>
<input type="submit" />
</form>
<a href="http://jqueryvalidation.org" target="_blank">Official jQuery Validation Documentation</a>
CSS
a {
display: block;
position: absolute;
bottom: 0;
}
JavaScript
$(document).ready(function() { // <-- ensure form's HTML is ready
$("#myform").validate({ // <-- initialize plugin on the form.
// your rules and other options,
rules: {
first_name: { // <-- this is the name attribute, NOT id
required: true
},
last_name: {
required: true
},
phone: {
required: true,
digits: true
}
}
});
});