Home >Web Front-end >JS Tutorial >Lecture 1 on learning JQuery from scratch_jquery

Lecture 1 on learning JQuery from scratch_jquery

WBOY
WBOYOriginal
2016-05-16 18:23:46842browse

The importance of JQuery should be self-evident to a coder. How many times have I been asked whether I know JQuery when applying for a job? How many times have I vomited blood due to browser incompatibility when writing scripts? How many times have I been asked because of the need? I used a script to create a simple effect but my hands cramped while writing it. After JQuery appeared, many problems were easily solved.
Every time we learn something, we always like to understand its history. Since we are starting from scratch, let’s also learn a little bit about its history.
jQuery was created by American John Resig. It has attracted many javascript experts from all over the world to join its team, including Jörn Zaefferer from Germany, Stefan Petre from Romania, etc.
jQuery is another excellent Javascript framework after prototype. Its purpose is - WRITE LESS, DO MORE, write less code and do more things.
It is a lightweight js library (only 21k after compression), which is beyond the reach of other js libraries. It is compatible with CSS3 and various browsers (IE 6.0, FF 1.5, Safari 2.0, Opera 9.0 ).
jQuery is a fast, concise javaScript library that allows users to more easily process HTML documents and events, achieve animation effects, and easily provide AJAX interactions for websites.
Another big advantage of jQuery is that its documentation is very complete and its various applications are explained in detail. There are also many mature plug-ins to choose from.
jQuery can keep the code and html content of the user's html page separated. That is to say, there is no need to insert a bunch of js in the html to call the command. You only need to define the id.
Let’s start our first DEMO. We will explain based on the DEMO. In the first lecture, we will only give a brief introduction without in-depth explanation and analysis. Netizens who need to provide source code can join the group: 34979719

Copy the code The code is as follows:

< ;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="JQuery_1._Default" %>






, you will be prompted after running: $ is not defined.

$ sign is an alias for jQuery "class", so $() constructs a new jQuery object. $() is the selector, and $(document) constructs a JQuery document object. The function ready () is a method of this jQuery object. After the DOM is loaded, the event of this method starts to be executed. When the event is triggered in DEMO, the alert method provided by it is executed. JQuery's methods are enclosed in a pair of parentheses (), followed by a semicolon.

That’s all for today. I hope netizens can forgive me for any shortcomings. I also hope that netizens can actively discuss and make corrections in time. In the next lecture, we will talk about JQuery's selector and how JQuery obtains the control value.
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