Rumah  >  Artikel  >  hujung hadapan web  >  jquery根据属性和index来查找属性值并操作_jquery

jquery根据属性和index来查找属性值并操作_jquery

WBOY
WBOYasal
2016-05-16 16:41:071050semak imbas
<div class="zy_menu clearfix">
<a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="1" id="assoeted1" class="hover_a">课件库</a> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="2" id="assoeted2">课堂实录</a> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="3" id="assoeted3">试题库</a> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="4" id="assoeted4">教案库 </a> <a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="5" id="assoeted5">素材库 </a>
</div>
var assoeted =5;

$(".zy_menu a[rel="+assoeted+"]").removeClass("hover_a").addClass("hover_a");
$(".zy_menu a").removeClass("hover_a").eq(assoeted-1).addClass("hover_a");
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn