Home > Web Front-end > JS Tutorial > body text

What are the reference methods for libraries in jQuery?

亚连
Release: 2018-06-13 14:52:44
Original
2142 people have browsed it

Below I will share with you an article on how to reference libraries in jQuery, which has good reference value and I hope it will be helpful to everyone.

jQuery is a lightweight JavaScript library that contains all jQuery methods.

If you want to use these methods, you must first reference this library.

Look at a piece of code first:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>蚂蚁部落</title>
<style type="text/css">
p{
 height:150px;
 width:150px;
 background-color:#ccc;
}
</style>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){ 
 $("#bt").click(function () {
 $("p").hide();
 }); 
}) 
</script>
</head>
<body>
<p></p>
<input type="button" id="bt" value="隐藏"/>
</body>
</html>
Copy after login

Use the $() method to get the specified element, and then use the hide() method to hide the element. To use these methods, for example, first introduce the jQuery library.

The way the above code introduces the library is:

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
Copy after login

Introduce the jQuery library from the Internet. Of course, you can also download this library and put it on your local machine, and then reference it. .

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Referring to bmob js-sdk in VUE (detailed tutorial)

How to implement favorites using vue

How to process arrays through v-for in vue

About npm and webpack configuration methods in node.js

How to format the current time through js?

The above is the detailed content of What are the reference methods for libraries in jQuery?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template