/ Published in: JavaScript
requires that a pulldown \\\"program1\\\" in form \\\"freshmen\\\" be set to anything but the first value in the option list. \\r\\n\\r\\nrequires jquery validate: http://docs.jquery.com/Plugins/Validation
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
jQuery.validator.addMethod( "selectNone", function(value, element) { //alert(element.options.selectedIndex); //if (element.value == "blank"){ if (element.options.selectedIndex == "0"){ return false; } else return true; }, "Please select an option." ); $(document).ready(function(){ $("#freshmen").validate({ rules: { program1: { selectNone: true } } });