/ Published in: PHP
                    
                                        
Adds a method to the jQuery Validation plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) to return false if the field equals a specified string
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// Add method
jQuery.validator.addMethod("notEqual", function(value, element, param) {
return this.optional(element) || value != param;
}, "Please specify a different (non-default) value");
// Use example
$("#form").validate({
rules: {
nameField: { notEqual: "Your Name" }
}
});
URL: http://stackoverflow.com/questions/3571347/how-to-add-a-not-equal-to-rule-in-jquery-validation
Comments
 Subscribe to comments
                    Subscribe to comments
                
                