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="myform">
<input type="text" name="firstname" class="group_input" /><br/>
<input type="text" name="lastname" class="group_input" /><br/>
<br/>
<input type="submit" />
</form>
JavaScript
$(document).ready(function () {
var names = "";
$('.group_input').each(function() {
names += $(this).attr('name') + " ";
});
names = $.trim(names);
$.validator.addClassRules("group_input", {
require_from_group: [1,".group_input"]
});
$('#myform').validate({
// other options,
groups: {
myGroup: names // reference the string
}
});
});