点击展开再次点击收起,话不多说,直接上代码
<body>
<div class="operate open">展开</div>
<script>
$(".operate").click(function () {
if ($(this).hasClass("open")) {//展开
console.log("open----");
$(this).removeClass("open");
$(this).html("收起");
} else {//收起
console.log("close----");
$(this).addClass("open");
$(this).html("展开");
}
})
</script>
</body>
























18605917465
客服QQ