Learning jQuery from scratch (1) Getting Started _ jquery

Source: Internet
Author: User
This article is the first to introduce jQuery. It provides a simple example to guide you on how to compile jQuery code and build a development environment. describes in detail how to use jQuery in Visual Studio. i. summary

This series of articles will take you into the wonderful world of jQuery. Many of them have their specific experiences and solutions. Even if you use jQuery, you can find some tips.

This article is the first to introduce jQuery. It provides a simple example to show you how to compile jQuery code and build a development environment. It explains in detail how to use jQuery in Visual Studio.

For more information, please indicate the products produced by Ziqiu! Blog entry!

Ii. Preface

Sorry first! "Learning ASP from scratch. net mvc "series of articles will not be updated when we will introduce Filter, because recently I have been researching and learning jQuery. people who have read my MVC series will be familiar with the series names and titles. soon, we will provide training to people in the company, so we have made this tutorial specially.

At the same time of writing, I referred to the series of jQuery tutorials on the Internet. I did not find any series of tutorials satisfactory to me on the blog and Google. I like to explain the Knowledge System in depth. I don't like writing the "learning notes" text. at the same time, this series will be completed soon (if there is work pressure, there is motivation), and if time permits, I will continue to update the MVC series of articles. again, I am sorry to my friends who are waiting for the MVC article!

In addition, most of the knowledge points of this series of articles come from the book "jQuery practice" by Turing Publishing House. We recommend that you purchase this book, which is a classic of jQuery books.

Let's start jQuery's journey.

Iii. What is jQuery?

JQuery is a Javascript script library. in my blog, I can find the "Javascript lightweight script library" series of articles. the Javascript script library is similar.. NET class library. We encapsulate some tool methods or object methods in the class library for your convenience.

Note that jQuery is a script library rather than a script framework. "library" is not equal to "framework". For example, "System assembly" is a class library, while "ASP. net mvc "is the framework. jQuery does not help us solve the Reference Management and function Management of scripts. These are what the script framework is doing.

The script library can help us complete the encoding logic and implement business functions. using jQuery will greatly improve the efficiency of writing javascript code and make the written code more elegant and robust. at the same time, the rich jQuery plug-ins on the network have turned our work into "drinking tea every day with jQuery"-because we have already stood on the shoulders of giants.

When you create an ASP. net mvc project, you will find that the jQuery class library has been automatically introduced. jQuery is almost a powerful script library of Microsoft! The perfect integration and smart sensing support allow. NET and jQuery to be seamlessly integrated! Therefore, to use. NET, you need to use jQuery instead of Dojo and ExtJS.

JQuery has the following features:

1. provides powerful functions

Using these functions can help us quickly complete various functions and make our code very concise.

2. Solve browser compatibility issues

The compatibility of javascript scripts in different browsers has always been a nightmare for Web developers. A page often runs normally in IE7 and Firefox, and some inexplicable problems occur in IE6. writing different scripts for different browsers is a pain point. with jQuery, we will wake up from this nightmare. For example, the Event event object in jQuery has been formatted as common in all browsers. In the past, we had to obtain the Event Trigger Based on the event, in ie, It is event. under the standard browser such as srcElements and ff, event.tar get. jqueryis a unified eventobject, so that we can use event.tar get in a browser to get the event object.

3. Implement rich UI

JQuery can achieve animation effects such as gradient pop-up and layer movement, so that we can have a better user experience. taking the gradient effect as an example, I wrote a gradient animation that is compatible with ie and ff. It was implemented using a large amount of javascript code, so it took a lot of effort to avoid it, after writing the script, I forgot it for a while without much help. it is effort-consuming to develop similar functions. now, using jQuery can help us quickly complete such applications.

4. Script knowledge for Error Correction

I proposed this article because most developers have incorrect understanding of javascript. for example, compile the DOM statement that is executed during loading on the page, directly add the "onclick" attribute to the HTML element or document object, and do not know that onclick is actually an anonymous function. technicians with these error scripts can complete all the development work, but such programs are not robust. for example, "write the DOM statement that is executed when loading in the page", there is no problem when the Page code is very small and users load quickly, when the page loading is slow, the browser "stop operation" error will occur. jQuery provides a lot of simple methods to help us solve these problems. Once jQuery is used, you will be able to correct these errors-because we all use standard and correct jQuery scripting methods!

5. Too many! Waiting for us to find out one by one. 4. Hello World jQuery

By convention, we compile the jQuery Hello World Program to take the first step of using jQuery.

At the end of this article, you can go to the complete source code in this chapter.

1. Download The jQuery class library

The jQuery project is downloaded on Google Code ,:

Http://code.google.com/p/jqueryjs/downloads/list href = "http://code.google.com/p/jqueryjs/downloads/list"> http://code.google.com/p/jqueryjs/downloads/list

The above address is the total download list, which contains many versions and types of jQuery libraries, mainly divided into the following categories:

Min: Compressed jQuery class library, used in the formal environment. For example: jquery-1.3.2.min.js

Vsdoc: in Visual Studio, You need to introduce this version of jquery class library to enable intelligent sensing. For example: jquery-1.3.2-vsdoc2.js

Release package: There is no compressed jquery code, as well as documentation and sample programs. For example: jquery-1.3.2-release.zip

2. Write a program

Create an HTML page, introduce the jQuery class library, and write the following code:

The Code is as follows:






Hello World jQuery!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.