开发者

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

开发者 https://www.devze.com 2022-12-22 17:10 出处:网络
how to determine the child of a UL using jquery? im trying to ch开发者_如何学Goange the class of the LI items in a UL based on their child type in a clickevent of an element?see following example

how to determine the child of a UL using jquery?

im trying to ch开发者_如何学Goange the class of the LI items in a UL based on their child type in a clickevent of an element?


see following example

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消