manraj82
manraj82

Reputation: 6295

how to determine the child of a <ul> using jquery?

how to determine the child of a UL using jquery?

im trying to change the class of the LI items in a UL based on their child type in a clickevent of an element?

Upvotes: 1

Views: 75

Answers (2)

rahul
rahul

Reputation: 187020

If you want to get the child elements then you can use

$("yourulid > li").addClass("something");

and if you want to get the descendant elements then

$("yourulid li").addClass("something");

See it working here.

Upvotes: 1

Saar
Saar

Reputation: 8474

see following example

http://api.jquery.com/children/

Upvotes: 2

Related Questions