当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery使用hide方法隐藏页面上指定元素的方法教程

jQuery使用hide方法隐藏页面上指定元素的方法教程

2019年03月31日  | 移动技术网IT编程  | 我要评论

本文实例讲述了jquery使用hide方法隐藏页面上指定元素的方法。分享给大家供大家参考。具体如下:

下面的js代码隐藏了网页中所有<p>标签的内容

<!doctype html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("button").click(function(){
  $("p").hide();
 });
});
</script>
</head>
<body>
<h2>this is a heading</h2>
<p>this is a paragraph.</p>
<p>this is another paragraph.</p>
<button>click me</button>
</body>
</html>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网