jQuery validation wont fire for dropdown/select lists -


yes might duplicate of million other questions it, me still doesnt work. according jquery validation documentation, having first default item empty value (value=""), , class "required" enough. refuses work correctly. have set correctly, , works fine on checkboxes, radiobuttons, text inputs no problem @ all, select lists? nope.

here simple example:

<select class="required" id="daydropdown" data-bind="'value': studentbasedata.day">     <option value="">dag</option> </select> <select class="required" id="monthdropdown" data-bind="'value': studentbasedata.month">     <option value="">måned</option> </select> <select class="required" id="yeardropdown" data-bind="'value': studentbasedata.year">     <option value="">År</option> </select> 

three dropdownlists, required. right here, odd thing first select validates. other 2 ignored. further down page have 2 more select lists refuses kind of validation.

here initiate validation plugin:

$(function(){     $.metadata.settype("attr", "validate");     $("#studentsform").validate({         ignore: ""     }); }); 

and force trigger validation when form submitted:

$('#updateprofilebutton').click(function subscribe() {     if($("#studentsform").valid()=== true){ //force trigger validation         // stuff     } else { // if jquery validation fails         // todo     } }); 

and said, works select lists.

if matters, select lists automatically populated 2 javascript functions (filling out dates etc.), initial default value set have shown above. strange thing works first select box, , thats it.

i have searched , searched , have never found same problem.

ps: "data-bind" knockout.js.

add name attribute dropdowns. should fix problem see first dropdown being shown invalid.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -