大佬教程收集整理的这篇文章主要介绍了jQuery找到最近的父母Div,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$(this).closest('.viewLogText').parent().find('.reportLog').css("display","none");
场景:
div中有三个子div元素,它们具有Css类“repeaterRecord”.子div具有css类 – repeaterIdentifier,viewLogtitle和reportLog.
有两个这种结构的div(div有Css类“repeaterRecord”).
带有viewLog类的div如下所示.
<div class="viewLogtitle"> <div class="viewLogText"> View Report Log </div> <div> <img alt="Expand" src="Images/PlusIcon.GIF" class="expandLogIcon" /> <img alt="Collapse" src="Images/MinusIcon.GIF" class="collapseLogIcon" /> </div> </div>
单击collapseLogIcon图像时,我需要隐藏(仅)具有“reportLog”类的最近div(在“viewLogtitle”的同一级别).我们怎样才能使用jQuery呢?
更新的工作示例:
http://jsfiddle.net/Lijo/L9w4F/11/和
http://jsfiddle.net/Lijo/L9w4F/8/和
http://jsfiddle.net/Lijo/L9w4F/12/
参考:
> Efficient,concise way to find next matching sibling?
> jquery select siblings ‘until’
以上是大佬教程为你收集整理的jQuery找到最近的父母Div全部内容,希望文章能够帮你解决jQuery找到最近的父母Div所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。