jQuery 库可以通过一行简单的标记被添加到网页中。
jQuery 是一个 JavaScript 函数库。
jQuery 库包含以下特性:
HTML 元素选取
HTML 元素操作
CSS 操作
HTML 事件函数
JavaScript 特效和动画
HTML DOM 遍历和修改
AJAX
Utilities
jQuery 库位于一个 JavaScript 文件中,其中包含了所有的 jQuery 函数。
可以通过下面的标记把 jQuery 添加到网页中:
<head><script type="text/javascript" src="jquery.js"></script></head>
请注意,<script> 标签应该位于页面的 <head> 部分。
<html>
<head><script type="text/javascript" src="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://my.oschina.net/ajian2014/blog/297003