This time I will bring you several ways to use the library in jquery, and what are the things to note when using the library in jquery. The following is a practical case. Let’s take a look. .
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>
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>
Introduce the jQuery library from the Internet. Of course, you can also download the library and put it on your local machine, and then reference it. .
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
jquery trigger function cannot trigger a tag. How to handle it
jquery form verification submission
jQuery check box selection and get the value
How to implement Jquery ajax asynchronous cross-domain
The above is the detailed content of There are several ways to use libraries in jquery. For more information, please follow other related articles on the PHP Chinese website!