jquery.validate not showing messages

javascript, jquery

Solution

1) Include jQuery in your fiddle

2) Add submit button to your HTML:

<input type="submit" value="Submit" />

3) Add missing `'` at the end of your `estimatedTaxesAndFees` message:

estimatedTaxesAndFees: 'Please enter taxes and fees' // <-- Here

Updated Fiddle

You need to add `name` attribute to your `input` to get custom message here:

<input type="text" class="form-control" name="vehiclePrice" id="vehiclePrice"
<input type="text" class="form-control" name="estimatedTaxesAndFees"

Updated Fiddle

Problem

Can't seem to find out why my jquery.validate script is not showing the messages. Anyone see what I am doing wrong? Trying to display messages in a separate div: html: ``` <form class="cmxform" id="commentForm" method="get" action=""> <label for="vehiclePrice" class="form-control-label vpl">Vehicle Price</label> <input type="text" class="form-control" id="vehiclePrice" placeholder="$0" onkeypress="return isNumberKey(event)" value="25592" required /> <label for="estimatedTaxesAndFees" class="form-control-label etfl">Estimated Taxes and Fees</label> <input type="text" class="form-control" id="estimatedTaxesAndFees" placeholder="$0" onkeypress="return isNumberKey(event)" value="2843" required /> </form> <div id="error-note"></div> ``` js: ``` $(document).ready(function() { $('#commentForm').validate({ errorLabelContainer: "#error-note", wrapper: "li", onfocusout: function(element, event) { this.element(element); }, rules: { vehiclePrice: 'required', estimatedTaxesAndFees: 'required' }, messages: { vehiclePrice: 'Please enter vehicle price', estimatedTaxesAndFees: 'Please enter taxes and fees } }); }); ``` fiddle

Original source