用jq实现简单的tab选项卡

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
ul li{
200px;
height: 30px;
border: 1px solid black;
}
.room{
300px;
height: 300px;
border: 1px solid red;
}
.room-two{
display: none;
}
.active{
background-color: yellow;
}
</style>
<script src="jquery-1.11.3.js"></script>
<script>
$(function(){
$('.room-select').click(function(){
$(".room-select").eq($(this).index()).addClass("active").siblings().removeClass('active');
$(".room div").hide().eq($(this).index()).show();
})
})
</script>
</head>
<body>
<ul>
<li class="room-select active">房态筛选</li>
<li class="room-select">批量操作</li>
</ul>
<div class="room">
<div class="room-one">我是房态筛选界面</div>
<div class="room-two">我是批量操作界面</div>
</div>
</body>
</html>

原文地址:https://www.cnblogs.com/qdphr/p/5742332.html