javascript - Comparing multiple values to multiple values -


i have couple of select boxes , need rows have compared select boxes.

so lets have 3 select boxes

#brand_id, #model_id, #memory_id 

and value empty on default. need check if selected , if selected want add array. if box not selected should add ids of box.

the condition can think of this:

//phones array contains rows     var filterarray = [];     if($("#brand").val() != ''){         $.each(phones, function(index, value){             if(value.brand_id == $("#brand").val()){                 filterarray.push(value.id);             }         });     }     if($("#brand").val() != '' && $("#model").val() != ''){         $.each(phones, function(index, value){             if(value.model_id == $("#brand").val() && value.model_id == $("#model").val()){                 filterarray.push(value.id);             }         });     } 

and on hope made clear mean there lot more conditions cover options up. , each select box add options increase method have add more conditions.

actually when validate on errors in form, , want specific error possible conditions when there multiple errors list of errors. here adds id array instead of showing error.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -