A summary of Jquery technology

Source: Internet
Author: User

Previous notes:

Now the project often use JS to operate some things, for the whole team development, JS writing specifications and correct development has a greater help. In a team, there will often be the unity of JS writing and browser incompatibility and other situations occur. I think the best way is to have a unified writing standard and a good compatibility and extensibility of the JS library as we develop the grassroots, to improve our team's development speed and performance.

For me, from the very beginning of the direct writing JavaScript method to the use of ExtJS and the jquery class library, the following points are touched:

1, must have a good JS Foundation, write a lot of basic JavaScript method;

2, with good JS Foundation, you can try to use jquery, ExtJS and other masters to write the class library, because they are based on JS as the basis for writing, and have experienced compatibility, stability, standardization and so on testing, and has a good integration and extensibility, for us to provide a standard use, And let us save time and effort;

3, with a new challenge do not be afraid, the first analysis of the difficulties, and then use the JS method to solve the problem;

I first recommend the jquery class library, which makes our development easy and easy.

Advantages: (Online search)

1, we can achieve a very strong flexibility of the clear page code. jquery separates JavaScript code from HTML page code, just like a few years ago when CSS made the style code separate from the page code.

2, the least code to do the most things, this is the slogan of jquery, but also worthy of the word. With its advanced selector, developers can achieve amazing results by writing just a few lines of code. Developers do not have to worry too much about browser differences, except that they fully support Ajax and have many other abstractions that improve developer programming efficiency. jquery brings JavaScript to a higher level.

3. In a large JavaScript framework, jquery has the best understanding of performance. Although different versions have many new features, the most streamlined version is only 18KB in size, and this number is hard to reduce. Every version of jquery has significant performance improvements. If you use it with a new generation of browsers with a faster JavaScript engine, such as Firefox 3 and Google Chrome, developers will have a new speed advantage when creating rich-experience web apps.

4, JS "" "" standard ", the reason for using quotation marks is that jquery is not an official standard. But the industry's support for jquery has been very broad. Google not only uses it itself, but also provides users with it. In addition, Dell, news aggregator website Digg, WordPress, Mozilla and many other manufacturers are also using it. Microsoft even integrates it into Visual Studio. With so many heavyweight vendors supporting the framework, users can be confident about their future and invest their time boldly.

5. The plug-in developed by jquery is now about thousands of. Developers can use plugins to perform tasks such as form confirmations, chart types, field hints, animations, progress bars, and more. The jquery community has grown into an ecosystem. This further proves the last reason that it is a safe choice. Moreover, jquery is actively working with "competitors", such as prototype. They seem to be pushing the overall development of JavaScript, not just plotting custodians.

6, if you want to really learn jquery, developers still need to invest a little time, especially if you want to write a large number of code or self-plug-ins, particularly. However, developers can take a "conquer" approach, and jquery provides a lot of sample code, and getting started is a very easy thing to do. I recommend that developers look at the plug-in before they write some kind of code, and then look at the actual plug-in code to see how it works. In short, learning jquery does not require developers to invest too much, it can quickly start development work, and then gradually improve skills

7. I found that using jquery is a fun thing to do. It's simple and powerful, and developers can quickly get the results they want. It solves many JavaScript problems and puzzles. I used to hate JavaScript programming, but now I like it very much. With some fundamental improvements, developers can really think about developing next-generation Web applications, no longer bothered by the poor language or tools. I believe it's "least code to do the most things" slogan

In order to save development and find the use of jquery method time, the following will often be used in some of the jquery methods and note-taking records for everyone to query and their own queries.

First, find object ()

JS:document.getElementById ("divID")

jq:$ ("#divID")

JS:document.getElementsByTagName ("input")

jq:$ ("input")

JS: No take classname

JQ: $ (". ClassName")

When the object is obtained, you can manipulate their properties, and when there are multiple objects, you can take advantage of the. EQ (i) method to get the individual objects. The values are:. Text () takes innertext value. html () takes innerHTML content. val () value

Second, judge whether the object is empty

Js:if (document.getElementById (' ID ') ==null)

Jq:if ($ ("#ID"). Length==0)

Third, Jquery Ajax use method

jquery provides a series of global methods to encapsulate the XMLHttpRequest object, and no longer have to worry about the browser client's problem in the Ajax development process.

One, $.ajax (options)
It is the most fundamental jquery Ajax method, it has only one parameter options, which contains the request information and the callback function information. The parameter contents are key:value to form and are optional.
Grammar:
$.ajax ({options});
URL: (string) The address of the sending request, which can be a server page or a WebService action.
Type: (string) request mode, post or get
Data: (object) When sending requests to the server. is key:value to form, such as: {name: "Grayworm", Sex: "Male"}, if array {works:["Work1", "Work2"]}
DataType: (String) The expected return data type. Xml,html,json,text, etc.
Beforesend: (Function) is triggered before an AJAX request is sent, and if it returns false, the request is canceled. If an asynchronous request needs to display an animated GIF, you should set the corresponding visible here.
function (XMLHttpRequest) {}

Complete: (function) The callback function (called when the request succeeds or fails) after the call is completed, and if the asynchronous request displays an animated GIF, it should be set here not visible.
function (xmlhttprequest,textstatus) {
Textstatus is a string that describes the return status
}

Success: callback function when the request execution succeeds
function (data,textstatus) {
Data is returned by the server, which can be in XML, JSON, text, and other formats
Textstatus is a string that describes the return status
}

Error: callback function when request execution fails
function (Xmlhttprequest,textstatus,errorthrown) {
Data is returned by the server, which can be in XML, JSON, text, and other formats
Textstatus,errorthrown is information that describes the return status
}

Iv. Jquery Setting Object properties

jq:$ ("#ID"). attr ("HTML", "<b> I want to Bold </b>") is handled with the attr attribute.

$ ("#ID"). Show (); $ ("#ID"). Hide () corresponds to style= "Display:none/block";

Five, window.onload=function () {}çè$ (function () {...}) onload execution

Six, event handling, onclick hover and other events, more practical

Click (FN) DblClick (FN) MouseDown (FN) MouseMove (FN)
mouseout (FN) mouseover (FN) MouseUp (FN) hover (FN)  

Seven, after the new knowledge point, slowly upload perfect

PS: Hope we JS development of normalization, later JS The code is uniformly put into JS file, and then make JS obfuscation, which I also often lazy, otherwise there will be security holes, "exposure parameters, exposure URL address ".

A summary of Jquery technology

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.