close
轉自 http://stackoverflow.com/questions/306583/this-selector-and-children
問題: div裡頭有一張圖, 目前抓到div, 要如何選擇到裡頭的圖片?
答案: $(this).find("img"); 或是 $(this).children("img");
--
I'd like to use a selector to select the child img of the div I'm clicking on this example:
To get the div, I've got this selector:
How do I get the img with a selector?
|
||||
feedback
|
831
|
The jQuery constructor accepts a 2nd parameter which can be used to override the context of the selection.
Which is the same as
If the imgs are direct descendants of the clicked element, you can also use:
|
||||||||||||||||||
feedback
|
--
全站熱搜