I have the following code working in Jquery.
I need to display the message "Year Required" when the value or option value of select element is "0".
My coding is as follows
Code:<script type="text/javascript"> $(document).ready(function () { $("#register").validate({ debug: true, rules: { year: { required: function () { return ($("#year option:selected").val() == "0"); } } }, messages: { year: "Year Required", }, }); }) </script>
Select box coding
For the above coding IE is not showing any errors. but the validations is not working. your suggestions shall be highly appreciatedCode:<select name="year" id="year"> <option value="0">Year</option> <option value="1">1919</option> <option value="2">1920</option> <option value="3">1921</option> <option value="4">1922</option> </select>



Reply With Quote
Bookmarks