tags:

views:

94

answers:

1

I am using ASP.NET webforms and jquery validation. I would like to check if a certain group of input elements are valid, rather than checking if all the input elements on the page are valid.

I would like a function like this. Note that frame is a div containing input elements. if any of invalidElements() are contained in the given div, return false, otherwise return true.

function frameIsValid(frame, validator) {

  validator.invalidElements().each(function() {
    if (frame.has($(this)))
      return false;
  }
  return true;
}

Help! Thanks!

A: 

Assuming invalidElements returns a list of tag names (or other valid selectors), you can use $(frame).contains(invalidElement)

eyelidlessness