Summary of self-jquery learning Essence

Source: Internet
Author: User
Tags mootools

Because of the project needs, but also because of interest, in the recent study and use of jquery, it is really too strong, the code is very elegant and concise, good regret to begin to understand it now, although the current network on jquery information, learning experience, tutorials more than you can see, But I still want to write down a little bit of my learning experience, whether it's for those who want to learn jquery or to keep a study note, which I think is necessary.
Before we talk about jquery, we have to mention the MooTools framework that is now very popular. On the Internet, many people compare MooTools to Java, which compares jquery to Perl. I have not studied mootools and I do not express my opinion, it has no meaning at all. As long as there is no major flaw in itself. It's all strong with good. Like Java and. NET argue for so many years, the same truth. Front-End UI sharing
JQuery, as the name implies, is JavaScript and query, which is a library of auxiliary development. is another excellent JavaScript framework following prototype. It was a blizzard that swept web front-end development, and jquery has been identified as a formal part of ASP. NET MVC and Visual Studio 2008, and the Nokia mobile platform Web Run-time will also be included in jquery. So, please be assured that there is no mistake in choosing jquery. If you see any hesitation here, then I'll say one more reason, and I should be able to dispel your last doubts. December 2009 Tiobe programming language leaderboard JavaScript rose to 8th place, and ranked 3rd in the strongest-rising language. I'm not here to talk about the leaderboard because it's going to spark an endless debate. I mean, the leaderboard doesn't explain everything, but at least it can be said that there are more people in which languages are being used, more people are more energetic, and other resources are richer. JavaScript scripts have been deep into web applications. And as a good JavaScript framework, its prospects are not to be doubted. Unless there's a more bull B than jquery, better stuff.
I'm not going to make a list of the basic uses of jquery like I did in tutorials, which would be boring and meaningless. The knowledge of the Internet is a lot of random search. I'm going to write my own feelings from the perspective of the project. Of course, a copy of the API Help document is essential, at the very end of the Jquery-1.2.6.chm download, the need for the user from.
first of all, we need to know that JavaScript development can be divided into the following four parts:
1. Find DOM elements for value and assignment operations, content-taking and assignment operations at specific node locations (InnerHTML).
2, for the elements of event monitoring.
3, by manipulating the DOM node to change the elements of the CSS style, to achieve a brilliant animation effect.
4. Perform AJAX operations on DOM elements.
for jquery, these four parts provide the perfect implementation:
A, jquery has a powerful selector that can find any DOM element. At the same time, the JQuery object implements the chain syntax, it is convenient and concise to write powerful operation. For example, the Action property: $ ("#chkbox"). attr ("Checked", "checked"). attr ("Disabled", "disabled"). You can continue the chain like this, including adding events, styles, and so on.
B. Bind the event to the DOM when the page loads. $ ("#chkbox"). Click (function () {alert ("Hello jquery!");});
C, Show (), and hide () are the most basic animations in jquery. Showing and hiding elements, of course, we can also implement other more complex animations.
D, $.ajax (options) is the lowest AJAX implementation in jquery. In addition, AJAX requests can be implemented using $.get () or $.post ().
After understanding the above, jquery brings us another surprise, is that its API supports a variety of mainstream browsers, so you no longer for IE, Firefox and other compatibility issues and scratching your hair headaches. In my previous projects, I always liked to write behavior or style attributes in the DOM. This is a very bad and extremely irregular approach. Now with jquery, I've pulled all the behavior out of the DOM and put it in the jquery initialization function to bind. and the initialization function of jquery is faster than the window.onload loading speed. Front-End UI sharing

$ (function () {
$ ("#chkbox"). Click (
function () {
Alert ("Hello jquery!");
}
);
});
<input type= "checkbox" id= "Chkbox"/>

The above is a shorthand method, whether it is an initialization function or a binding event. It is recommended to use this notation.
※ The following writing is undesirable, and the behavior must be separated from the DOM:

function Chkclick () {
Alert ("Hello JQuery");
}
<input type= "checkbox" id= "Chkbox" onclick= "Chkclick ()"/>

※ Do not write the style into the DOM, it is very difficult to maintain the thing:

<span style= "font-size:15pt;color:red" >hello jquery</span>

CSS files should be used to define or define class classes, or to define IDS: front-end UI sharing

. spanclass{
font-size:15pt;
color:red;
}
<span class= "Spanclass" >hello jquery</span> #hello_span {
font-size:15pt;
color:red;
}
<span id= "Hello_span" >hello jquery</span>

     have some knowledge of jquery?" Next time we continue our discussion.

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.