jQuery Validation Plugin: help with required dependency expression
I'm somewhat new to jQuery and JavaScript and trying out my first use of the Validation plugin (which is excellent).
I have a form in which one of the text inputs has an id of 'name', an initial value of 'Name', and is a required field. I need for it NOT to validate if empty OR if it has a value of 'Name'. Here's what I have so far which is clearly wrong as it's not working!...
- $('#enquiry').validate({
- rules: {
- name: {
- required: function(element) {
- return $('#name').val() == 'Name';
- }
- },
- // Email rule follows
Can anyone help please?
On a more general note, is there a good place where the logic of what's going on inside these dependency expressions and the syntax expected is walked through? I'm finding it hard to figure. I've searched around quite a bit but not found anything yet.