[Solved] What does “>” mean in jQuery and how to use it?


$pages will be all immediate child divs of #main.
If you have

<div id=main>
    <div id=1>
        <div id=2></div>
    </div>
    <div id=3></div>
    <div id=4></div>
    <span id=5>
        <div id=6></div>
    </span>
</div>

Then $('#main > div') will fetch 1, 3, and 4.

If you did $('#main div') then you’re finding all matching descendants, not just immediate ones, so that would match 1, 2, 3, 4, and 6.

2

solved What does “>” mean in jQuery and how to use it?