Bug Tracker

Opened 9 years ago

Closed 9 years ago

#14482 closed bug (notabug)

children method doesn't work as the example shows

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:


according to the API documentation on children(), i should get only first level children which matches the selector.

I tested the example given in the documentation with some little change: html: <ul class="level-1">

<li class="item-i">I</li> <li class="item-ii">II

<ul class="level-2">

<li class="item-a">A</li> <li class="item-a">B

<ul class="level-3">

<li class="item-a">1</li> <li class="item-a">2</li> <li class="item-a">3</li>


</li> <li class="item-c">C</li>


</li> <li class="item-iii">III</li>


js: $( "ul.level-2" ).children("item-a").css( "background-color", "red" );

according to the documentation, this should color only A,B and C, but it also colors 1,2 and 3 which is what i would expect from method find()

Change History (1)

comment:1 Changed 9 years ago by scottgonzalez

Resolution: notabug
Status: newclosed

That's how CSS works. If you inspect the applied styles, you'll see they're only applied to the direct children, but they cascade down. If you need more help, please use the forums or Stack Overflow.

Note: See TracTickets for help on using tickets.