jQuery Validate Method: notEqual

I often have the need with jQuery validate to test whether or not a value is equal to a predetermined one. The method below provides that functionality:

~

I often have the need with jQuery validate to test whether or not a value is equal to a predetermined one. The method below provides that functionality:

jQuery.validator.addMethod("notEqualTo", function(v, e, p) {  
  return this.optional(e) || v != p;
}, "Please specify a different value");

Which can then be used in a similar fashion to this:

$("form").validate({  
  rules: {
    nameField: { notEqualTo: "Placeholder Text Name" }
  }
});