页面上有两个 Div 用 JQuery 控制 Div 显示和隐藏。实现Div间切换的需求
<div class="IndConK Huans overH" id="divExtTelList"> 11111111111111111111 <div> <div class="IndConB flex" id="divExtTelStatus"> 22222222222222222 <div>
菜单
<ul class="menuU Huans"> <li> <a href="javascript:;" class="menuUa flexC fl-bet Huans"><p>功能菜单</p><span>[0/5]</span></a> <div class="menuUn Huans"> <a href="javascript:;" class="menuUna flexC fl-bet Huans"><p>调度专区</p><span>[0/5]</span></a> <a href="javascript:;" class="menuUna flexC fl-bet Huans"><p>分机列表</p><span>[0/5]</span></a> </div> </li> </ul>
JQuery
// 切换 $(".menuUn > a").click(function(){ let index= $(this).index(); console.log(index); if(index==0){ $("#divExtTelStatus").show(); $("#divExtTelList").hide(); }else if(index==1){ console.log("index==1"); $("#divExtTelList").show(); $("#divExtTelStatus").hide(); } });
标签:JQuery,index,console,show,Div,divExtTelStatus,隐藏 From: https://www.cnblogs.com/hailexuexi/p/17544480.html