Home >Web Front-end >JS Tutorial >A preliminary understanding of the JavaScript function library jQuery_jquery

A preliminary understanding of the JavaScript function library jQuery_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 15:54:231044browse

The jQuery library can be added to a web page with a simple line of markup.
jQuery Library - Features

jQuery is a JavaScript function library.

The jQuery library includes the following features:

  • HTML element selection
  • HTML element operations
  • CSS operations
  • HTML event function
  • JavaScript special effects and animations
  • HTML DOM traversal and modification
  • AJAX
  • Utilities

Add the jQuery library to your page

The jQuery library is located in a JavaScript file that contains all jQuery functions.

jQuery can be added to a web page through the following tag:

<head>
<script type="text/javascript" src="jquery.js"></script>
</head>

Please note that the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag should be in the 93f0f5c25f18dab9d176bd4f6de5d30e section of the page.
Basic jQuery Example

The following example demonstrates jQuery's hide() function, hiding all e388a4556c0f65e1904146cc1a846bee elements in an HTML document.
Example

<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>

Try it for yourself
Download jQuery

There are two versions of jQuery available for download: a minified version and an uncompressed version (for debugging or reading).

Both versions are available for download from jQuery.com.
Library replacement

Both Google and Microsoft have great support for jQuery.

If you don't want to host the jQuery library on your computer, you can load the CDN jQuery core files from Google or Microsoft.
Use Google’s CDN

<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
</head>

Use Microsoft’s CDN

<head>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery
/jquery-1.4.min.js"></script>
</head>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn