jQuery Validation rule based on select value
Clash Royale CLAN TAG #URR8PPP jQuery Validation rule based on select value I have the following form. <form id="myform"> <select id="country" name="country"> <option value="US">United States</option> <option value="CA">Canada</option> <option value="AU">Australia</option> <option value="NZ">New Zealand</option> <option value="IE">Ireland</option> </select> <input type="text" name="zip_code" id="zip-code"> <input type="submit"> </form> I want the zip_code field to contain the digits: true rule when the selected country is United States . This is what I have tried based on this code. zip_code digits: true United States $("$myform").validate({ rules:{ zip_code: { required: true, ...