I have a load of elements in a form hidden until the user activates it. I am using something like this:
<div class="hidden"><input type="text" class="required" /></div> <div><input type="text" class="required" /></div> where the first div is hidden. I also have a required class on each element for validation purposes. This works like this: $('.required').each(function(i) { if ($(this).val() == "") { var msg = $(this).attr("title"); showErrorMsg($(this).parent(), msg); } }) I validate on submit but the problem is that all elements regardless of whether they are hidden or not get validated. What I need to be able to say is: get all elements that have the class 'required' as long as the container does not have the class 'hidden' but sometimes there are loads of nested elements so its not always the parent as such. I've tried 'filter' and 'not' but with success, anyone got any ideas (it may be my syntax)? _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/