Javascript 将目标的子级发送到JQuery中的函数

Javascript 将目标的子级发送到JQuery中的函数,javascript,jquery,Javascript,Jquery,如果我有这样的设置: <a href="#"><span class="pickme"></span></a> <a href="#"><span class="pickme"></span></a> <a href="#"><span class="pickme"></span></a> 您可以使用.find查找.pickme子项: $'a'。每个函

如果我有这样的设置:

<a href="#"><span class="pickme"></span></a>
<a href="#"><span class="pickme"></span></a>
<a href="#"><span class="pickme"></span></a>
您可以使用.find查找.pickme子项: $'a'。每个函数{ $this.find'.pickme'.on'mouseenter',function e{ enterBtne.target; }; $this.find'.pickme'.on'mouseleave',function{ leaveBtne.target; }; }; 函数enterBtne{console.log$e.text+'In';} 函数leaveBtne{console.log$e.text+'Out';}
使用jquery api中的children方法它将选择选择器父级的子元素使用类名作为该方法的参数,以便在不传递任何参数的情况下仅包含该类的子元素。选择所有子元素

$('a').each(function() {
$(this).on('mouseenter', function() {
enterBtn($(this).children(".pikckme"));
});
 $(this).on('mouseleave', function() {
 leaveBtn($(this).children(".pickme"));
});
});
您可以使用/以子对象为目标。当您的函数接受DOM元素时,使用获取它的引用

$('a').on('mouseenter', function (e) {
    enterBtn($(this).find('.pickme').get(0));
}).on('mouseleave', function (e) {
    leaveBtn($(this).find('.pickme').get(0));
});

您可以使用.find,即输入BTN$this.find'.pickme'。get0@Satpal谢谢,这就是我需要的。加上作为答案。
$('a').on('mouseenter', function (e) {
    enterBtn($(this).find('.pickme').get(0));
}).on('mouseleave', function (e) {
    leaveBtn($(this).find('.pickme').get(0));
});