I would like to select the p element in the following html
<div class="parent">
<p>Stg</p>
</div>
in this JS
$('.parent').hover(
function() {
$(this.p).aFunction(){
};
});
I can't find the correct selector...
There are a few ways to accomplish this:
$(this).find('p').func();
$(this).children('p').func();
$('p', this).func();
Try:
$('.parent').hover(
function() {
$(this).find("p").someJQueryMethod();
});
$('.parent').hover(
function() {
$(this).find('p').aFunction(){
};
});
使用选择器
$('.parent p')
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.