jquery使用hide方法隐藏指定id的元素

转载:https://www.jb51.net/article/63064.htm

下面的代码通过jQuery的hide方法隐藏了id=test的元素

<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("button").click(function(){
  $("#test").hide();
 });
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p id="test">This is another paragraph.jb51.net</p>
<button>Click me</button>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_34266804/article/details/89001456