I have a jQuery object obj
that encapsulates a set of input elements.
I am using this code in order to make an array out of each element's value :
$.map(obj, function(elem, i){
return $(elem).val();
});
The problem is that sometimes some of the input fields contain invalid values and i would like to skip them in the process of creating the array. Doing a simple return false
doesn't seem to skip the element but instead inserts a false
in the array.
I would like to know if there is a way to actually do that without using .each
explicitly.