From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/glossary/jquery/index.html | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 files/zh-cn/glossary/jquery/index.html (limited to 'files/zh-cn/glossary/jquery/index.html') diff --git a/files/zh-cn/glossary/jquery/index.html b/files/zh-cn/glossary/jquery/index.html new file mode 100644 index 0000000000..f0a4d1ce37 --- /dev/null +++ b/files/zh-cn/glossary/jquery/index.html @@ -0,0 +1,58 @@ +--- +title: jQuery +slug: Glossary/jQuery +tags: + - JQuery + - JavaScript + - 术语 +translation_of: Glossary/jQuery +--- +

jQuery 是一个着重简化 {{Glossary("DOM")}} 操作,{{Glossary("AJAX")}} 调用和{{Glossary("Event", "事件")}}处理的 {{Glossary("JavaScript")}} {{Glossary("Library", "库")}}。一些前端 JavaScript 开发者经常会用到它。

+ +

jQuery 使用 $(selector).action() 的格式给一个(或多个)元素绑定事件。具体来说,$(selector) 让 jQuery 选择匹配 CSS 选择器 selector 的元素,并将它/它们传递给叫做 .action() 的事件 {{Glossary("API")}}。

+ +
$(document).ready(function(){
+  alert("Hello World!");
+  $("#blackBox").hide();
+});
+ +

上述代码和以下代码功能相同:

+ +
window.onload = function() {
+  alert( "Hello World!" );
+  document.getElementById("blackBox").style.display = "none";
+};
+ +

下载 jQuery

+ + + + + + + + + + + + + + + + +
npmbower(单文件)Google CDN
npm install jquerybower install https://code.jquery.com/jquery-3.2.1.min.jshttps://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
+ +

更多学习

+ +

基本知识

+ + + +

技术信息

+ + -- cgit v1.2.3-54-g00ecf