alechill / livevalidation

Open source javascript library for slick, powerful, and easy client-side validation.
http://livevalidation.com
Other
151 stars 57 forks source link

exclude default 'select' value in form select element #20

Open oshihirii opened 10 years ago

oshihirii commented 10 years ago

Is it possible to exclude the default 'select' value in a form select element?

jQuery

var myVariable = new LiveValidation('my_id', { validMessage: 'valid input', wait: 500});
myVariable.add( Validate.Exclusion, { within: [ 'select' ] } );

HTML

<select required name="my_name" class="my_class" id="my_id">
<option selected value="select">select</option>
... other options
</select>

The above is not working, ie a valid message is shown when selecting an allowable option, but when selecting 'select' and moving on it is not raising validation errors.