简体   繁体   中英

jQuery: CSS Selectors

How would I use jQuery CSS Selectors to find for instance:

css class name: "Text" which is a div inside of dom object "wrapper"?

$('#wrapper div.Text')或$('#wrapper .Text'),具体取决于您想要的具体程度。

要添加到nezroy的答案中,请执行以下操作:$('#wrapper> div.Text')如果只希望元素直接位于包装器中,而又不希望所有元素嵌套在其中。

either

$('#wraper .text')

or

$('.text', $('#wraper'))

will work well with same results (even tho, i guess the second option is faster)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM