Home Web Front-end JS Tutorial jQuery idiot-level introductory tutorial_jquery

jQuery idiot-level introductory tutorial_jquery

May 16, 2016 pm 06:42 PM
jquery Getting Started Tutorial

If you know JS, please avoid it, this article is too idiotic for you; if you don’t know HTML and CSS, please avoid it, you may not understand the following content. (It’s best to speak a little English, otherwise it will be very troublesome)

What is jQuery?
jQuery is a JavaScript library. The idiot’s explanation is that it is a JavaScript toolbox. There are many ready-made tools. You can use whatever you want. It saves you the trouble of rewriting the code yourself, and it is even easier for JS idiots like me to get started.

What can jQuery do?
It can produce many surprising dynamic effects on your page. Simply put, it makes your website more beautiful. There are many different effects here. Click to view >>>

How to use jQuery ?
To put it simply: by calling the jQuery library (a js file) on the page, you can easily use the tools in it (you need another js to call the tools in jQuery) to achieve the desired effect.

Step one: Find the desired effect
The effects on this site come from two places: sonicHTML and jQuery tools. There are more effects on the Internet, and if you are willing to spend time, you can look elsewhere.

Step 2: Code-stealing
First of all, we recommend Firefox firebug, a code-stealing tool. If not, go get it now! When skimming code, you need to be very careful about two things!

1. HTML and CSS in static pages

Use firebug to extract the HTML and CSS code of the part you want in the page. Do not move the id and class of this part, keep them as they are. !

At the same time, there may be an empty

such as this effect>>> before the HTML element you want, don’t miss it!

2. js in

⑴ Among the js called, there will definitely be a js with "jQuery" in the file name. Directly add the Copy the code and make it your own file.

⑵ There must be another js in . This js will have the following code:

$(document).ready(function() {

// There is other code in the middle

});
This js may be an external file called, or it may be in the head (it is also possible in the body, but the possibility is low) with
Form appears. The id or class in the previous HTML will definitely appear in this part. It must be consistent. If you want to use another name, you must remember to synchronize it in HTML and js. If it is different, it will fall short

Step 3: Test locally and correct errors
Create new HTML and CSS locally , JS, put all the code you picked up, and call all the files that should be called. The exciting time has arrived! Use a browser to open the static page and see if it works. If it comes out, congratulations! Take the next step and make it your own! If it doesn’t work, start checking carefully:

⑴Possible errors in HTML:

①You have modified the id or class in HTML [Solution: Change back to the original]
②The empty
is missing [Solution: Check the HTML you removed to see if there is an empty
before and after, add it and try again]

⑵JS Possible errors:

① Error in the calling path [Solution: Modify to a valid calling path, it is most convenient to put js and HTML together]

② Ready is missing (detailed code is above ) This js (may be an external file, may be the code in the head) [Solution: Find the ready code in the original static page, copy and add]

③The id or class in ready and Inconsistencies in HTML [Solution: Find the corresponding relationship in the original HTML and js, and modify it to be consistent]

Step 4: Modify the HTML and css to make it your own
There is no such thing in this step It’s a fixed method, you can modify it however you want, but be sure to note that the id and class in HTML must correspond to js!

Step 5: Add it to your own page
There is basically nothing to say about this, but I still want to say something to WP users: external file calls are all in header.php in the theme folder (I was looking for it for a long time~~~~)
Attachment:
1.A very complete tutorial on the jQuery official website (very detailed, I recommend reading it carefully if you want to learn)>> >

2.Introduction manual in jQuery tools (short and concise, highly recommended if you want to get started quickly) >>>

3.sonicHTML (a blog subscribed to in Greader, often with cases and demos, very practical) >>><script></script>
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Detailed explanation of jQuery reference methods: Quick start guide Detailed explanation of jQuery reference methods: Quick start guide Feb 27, 2024 pm 06:45 PM

Detailed explanation of jQuery reference method: Quick start guide jQuery is a popular JavaScript library that is widely used in website development. It simplifies JavaScript programming and provides developers with rich functions and features. This article will introduce jQuery's reference method in detail and provide specific code examples to help readers get started quickly. Introducing jQuery First, we need to introduce the jQuery library into the HTML file. It can be introduced through a CDN link or downloaded

How to remove the height attribute of an element with jQuery? How to remove the height attribute of an element with jQuery? Feb 28, 2024 am 08:39 AM

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

How to use PUT request method in jQuery? How to use PUT request method in jQuery? Feb 28, 2024 pm 03:12 PM

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

jQuery Tips: Quickly modify the text of all a tags on the page jQuery Tips: Quickly modify the text of all a tags on the page Feb 28, 2024 pm 09:06 PM

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: &lt

Use jQuery to modify the text content of all a tags Use jQuery to modify the text content of all a tags Feb 28, 2024 pm 05:42 PM

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on ​​the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

How to tell if a jQuery element has a specific attribute? How to tell if a jQuery element has a specific attribute? Feb 29, 2024 am 09:03 AM

How to tell if a jQuery element has a specific attribute? When using jQuery to operate DOM elements, you often encounter situations where you need to determine whether an element has a specific attribute. In this case, we can easily implement this function with the help of the methods provided by jQuery. The following will introduce two commonly used methods to determine whether a jQuery element has specific attributes, and attach specific code examples. Method 1: Use the attr() method and typeof operator // to determine whether the element has a specific attribute

Understand the role and application scenarios of eq in jQuery Understand the role and application scenarios of eq in jQuery Feb 28, 2024 pm 01:15 PM

jQuery is a popular JavaScript library that is widely used to handle DOM manipulation and event handling in web pages. In jQuery, the eq() method is used to select elements at a specified index position. The specific usage and application scenarios are as follows. In jQuery, the eq() method selects the element at a specified index position. Index positions start counting from 0, i.e. the index of the first element is 0, the index of the second element is 1, and so on. The syntax of the eq() method is as follows: $("s

Summary of commonly used file operation functions in PHP Summary of commonly used file operation functions in PHP Apr 03, 2024 pm 02:52 PM

目录1:basename()2:copy()3:dirname()4:disk_free_space()5:disk_total_space()6:file_exists()7:file_get_contents()8:file_put_contents()9:filesize()10:filetype()11:glob()12:is_dir()13:is_writable()14:mkdir()15:move_uploaded_file()16:parse_ini_file()17:

See all articles