jquery如何选择this下的子元素

用find来实现:

示例:

$(this).find('span').addClass('span-black');

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

示例2:鼠标移动上去添加css,鼠标移出去删掉css,jquery实现代码如下

        <script type="text/javascript">
$(document).ready(function(){
$(".reply-action").on({  
        mouseover : function(){  
        $(this).find('span').addClass('span-black');
        },  
        mouseout : function(){  
        $(this).find('span').removeClass('span-black');
        }   
    });
});
</script>


猜你喜欢

转载自blog.csdn.net/qq_37811638/article/details/79900984
今日推荐