代码示例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.hide{
display: none;
}
</style>
</head>
<body>
<div>
<div class="menu">菜单一</div>
<div class="con hide">
<p>11111</p>
<p>22222</p>
<p>33333</p>
<p>44444</p>
</div>
</div>
<div>
<div class="menu">菜单二</div>
<div class="con hide">
<p>11111</p>
<p>22222</p>
<p>33333</p>
<p>44444</p>
</div>
</div>
<div>
<div class="menu">菜单三</div>
<div class="con hide">
<p>11111</p>
<p>22222</p>
<p>33333</p>
<p>44444</p>
</div>
</div>
<script src="jquery-3.2.1.js"></script>
<script>
$(function () {
bindclick();
});
function bindclick() {
$('.menu').click(function () {
$(this).next().removeClass('hide').parent().siblings().children('.con').addClass('hide')
})
}
</script>
</body>
</html>