一个js的问题/jquery

来源:百度知道 编辑:UC知道 时间:2024/06/07 16:19:06
$(document).ready(function() {
$(".imm").mouseover(function(){
this.style.border='#000000 1px solid';
this.span.style.display='none';
});
});

我用jquery做一个操作,当class="imm" mouseover时,边框变成1像素黑色,它里面的<span>隐藏,现在用这段代码,border是显示出来了,可是里面的<span>怎么也隐藏不了
大虾们帮忙看一下,是哪里的问题呢

<script>
$(document).ready(function(){
$('.imm').mouseover(function(){
$(this).css({border:'1px solid black'})
$(this).children('span').hide();
}).mouseout(function(){
$(this).css({border:'1px solid white'})
$(this).children('span').show();
});
});
</script>
能否满足您的需求?

你的class="imm"是设置在哪里了的?感觉是你this.span选取不到

尝试一下$(".imm span").text("");
这样把span里的内容清除