Jquery 如果我只有一个类,如何显示div中的元素?

Jquery 如果我只有一个类,如何显示div中的元素?,jquery,function,hover,Jquery,Function,Hover,我有以下代码: $('.my-image').function(){ $(this + ' div').show(); }, function(){ $(this + ' div').hide(); }); 我知道它不起作用,因为我请求一个带有div的对象,但我不知道如何更明确 <div id='galery'> <div class='my-image'><div></div></div> <div c

我有以下代码:

$('.my-image').function(){
   $(this + ' div').show();
},
function(){
   $(this + ' div').hide();
});
我知道它不起作用,因为我请求一个带有div的对象,但我不知道如何更明确

<div id='galery'>
   <div class='my-image'><div></div></div>
   <div class='my-image'><div></div></div>
</div>
如何调用jquery函数来显示内部div子div?

这是一个DOM元素;不能将其连接到选择器中

你在试着写作

$(this).find('div')
应该是

$(this).find("div").show();

这是一个对象,不是字符串。

请尝试使用子对象:

$('.my-image').function(){
   $(this).children('div').show();
},
function(){
   $(this).children('div').hide();
});

因为jQuery没有一个名为function的函数,所以它不起作用。你有没有复制粘贴错误?我想他缺少了一个函数,比如hover。。。猜猜看
$("div", this).show()
$('.my-image').function(){
   $(this).children('div').show();
},
function(){
   $(this).children('div').hide();
});