0
  I can't seem to quite figure this one out; not sure if I'm even providing a test 

condition; Also, "blanks" variable is to hold the value of the elements with the".required" class during the loop.

 function containsBlanks(){
var blanks = new Array();
$required.each(function(){
blanks.($(this).val() == "");
});
  return(true);
}

2 Answers2

0

If I understand you can do this like:

$('input.required').filter(function(){ return !this.value });

That will give you all required inputs that have an empty value (if any). Then you can check the length property to find out if there are any elements in that collection.

elclanrs
  • 92,861
  • 21
  • 134
  • 171
0

Loop over your Nodes and check their value against ""..

function containsBlanks() {
    var i, req = $('.required');
    for (i = 0; i < req.length; ++i)
        if (req[i].value === '')
            return true;
    return false;
}
Paul S.
  • 64,864
  • 9
  • 122
  • 138