javascript选项卡切换样式

时间:2021-10-30 11:02:41

HTML代码

  <ul class="touzi_xuan1" id="qixian">
    <li>****: </li>
    <li style="width: 18px;">&nbsp;</li>
    <li><a href="javascript:void(0);" onclick="searchPersonZi(this);" class="on">****</a></li>
    <li><a href="javascript:void(0);" onclick="searchPersonZi(this);">****</a></li>
  </ul>

javascript代码

  function searchPersonZi(obj) {
    
    jQuery(obj).parent().parent().find("a").removeAttr("class");
    jQuery(obj).attr("class","on");   }