标签:
<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery-1.11.1.min.js">xuan
</script>
<script>nbeihaozh
//$(整个HTML文档对象模型).整个页面准备好了后执行(方法)
$(document).ready(function()o)p 标签通过css选择器聚焦过去
//选择器 #(id)选择器 .name (class选择器) 标签选择器
$("p").click(function(){
//方法是$ 当前对象隐藏
$(this).hide();
});
});
</script>
</head>
<body>
<p>如果您点击我,我会消失。</p>
<p>点击我,我会消失。</p>
<p>也要点击我哦。</p>
</body>
</html>
jQuery 库 - 特性 jQuery 是一个 JavaScript 函数库。 jQuery 库包含以下特性: HTML 元素选取 HTML 元素操作 CSS 操作 HTML 事件函数 JavaScript 特效和动画 HTML DOM 遍历和修改 AJAX Utilities
下面的例子演示了 jQuery 的 hide() 函数,隐藏了 HTML 文档中所有的 <p> 元素。
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(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 type="button">Click me</button>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/hanke123/p/4970431.html