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="my_form">
1 <input type="text" name="fieldOne" class="ccustom" /><br />
2 <input type="text" name="fieldTwo" /><br />
<button type="submit">Submit</button>
</form>
JavaScript
$(function () {
$.validator.addClassRules("ccustom", {
required: true,
remote: function(element) {
console.log('here');
return {
url : '/echo/json/',
type:'post',
data: {
json: JSON.stringify(
($(element).val() == "123")
? "true" :
"Must be 123"),
delay: 0.3
}
}
}
});
$("#my_form").validate();
});