JQuery syntax re select

supportoranges used Ask the Experts™
$('select > option').each(function()

Would somebody please explain how I'm supposed to interpret the  '>'  ?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
> means a direct descendent of someething, e.g.

<div id='dog>
   <div id='cat'>
   <div id='cat2'>



would update both the cat and cat2 divs, which are children of dog

In your case, you probably have something like this:

<select id='question'>

since <option> is a direct descendent of <select>, your selector would include all of the options in that particular select, but would not include any options outside of that select.


thank you soooooo much!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial