jQuery 遍历siblings() 的使用方法
作者:互联网
$(document).ready(function(){
//选择账户的类型
$("div.rgtype li").click(function(){
$(this).addClass("ppt").siblings("li").removeClass("ppt");
$("#mtype").attr("value",$(this).find("p").text());
});
})
<div class="rgtype">
<h4>选择账户类别</h4>
<ul>
<li class=''><img src='templets/images/reioc01.png' alt='' />
<p>个人</p>
</li>
<li class=''><img src='templets/images/reioc03.png' alt='' />
<p>机构</p>
</li>
<li class=''><img src='templets/images/reioc02.png' alt='' />
<p>企业</p>
</li>
<li class=''><img src='templets/images/reioc04.png' alt='' />
<p>媒体</p>
</li>
<li class=''><img src='templets/images/reioc05.png' alt='' />
<p>高新区</p>
</li>
<li class=''><img src='templets/images/reioc06.png' alt='' />
<p>孵化器</p>
</li>
</ul>
<div class="clear"></div>
</div>
标签:jQuery,function,遍历,账户,li,ppt,siblings 来源: https://blog.51cto.com/14262733/2446303