tags:

views:

20

answers:

2

I want to find all elements in a form with one or more classes assigned to them.

eg: something like:

var formElements = $('#MyForm').find('.classA .classB')

if some elements have classA assigned and some elements have classB assigned, will an element having both be returned more than once?

+2  A: 

No.

In general, jQuery will never give you the same element more than once.

SLaks
+3  A: 

No; selectors either do or don't match a given element. The retrieval mechanism doesn't go out multiple times and build multiple lists.

Besides, you're not specifying "all classA and classB elements", you're specifying "classB elements within classA elements". What you're implying would look like:

var formElements = $('#MyForm').find('.classA, .classB')
chaos