Detect if any fields have a specific value on form submission
I'm trying to prevent a form from submitting if any fields on there have a specific value:
- $('#form-register form').submit(function() {
- if ($(this).find('*[value="Select Brand"]').length > 0);
- alert ('Please select an appliance and a brand');
- return false;
- });
However I seem to get the alert message every time I try to submit the form, even when no fields have that value.
There is a select box that has 'Select Brand' as its default value, however I still get the message even when I change it to something else.
Can anyone see what I'm doing wrong?