单机显示、双击隐藏
<style>
div {
width: 500px;
height: 200px;
background-color: green;
display: none;
}
</style>
<body>
<button id="btn">单击显示,双击隐藏</button>
<br><br>
<div> </div>
<script src="../jquery-3.4.1.js"></script>
<script>
$(function () {
$('#btn').click(function () { //单击事件
$('div').css('display', 'block');
$('div').html('div显示出来');
})
$('#btn').dblclick(function () { //双击事件
$('div').css('display', 'none');
})
});
</script>
</body>
效果图
初始状态隐藏,单机显示
双击隐藏
事件绑定
<style>
div{
width: 200px;
height: 200px;