Blogger Information
Blog 38
fans 0
comment 1
visits 36383
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
jQuery基础语法点击切换隐藏或显示两种方法
夜澜风的博客
Original
621 people have browsed it

实例

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>jQuery基础语法点击切换隐藏或显示两种方法</title>



<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>



</head>

<body>

<script type="text/javascript">



$(function(){

 
$("button").click(function(){
	if ($("div").is(":hidden")){

		$("div").show();

	}else{

		$("div").hide();
	}

	

  //$("div").toggle();//toggle() 的作用就是当对象是显示的就隐藏,当是隐藏的则显示。
})

})

</script>

<div style="width: 100px;height: 100px;background: pink;"></div>

<button>点击</button>

</body>

</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post