jquery Learning Summary

Source: Internet
Author: User
Tags mootools

Because of the project needs, but also because of interest, in recent time research and use ofJQuery, it is really too strong, the code is very elegant and concise, good regret to start to understand it now, although the current network onjquery information, learning experience, the tutorial more than you can see, but I still want to put their own little learning experience written down, whether it is provided to those who want to learnjquery, or keep a copy of the study notes, I think this is very necessary.
is sayingjquery before, have to mention now also very popularMooTools frame. On the internet, many people putMooTools compared toJava, putjquery comparesPerl. I haven't studied it.MooTools, and no comment, it has no meaning at all. As long as there is no major flaw in itself. It's all strong with good. LikeJava and. NET argued for so many years, the same truth.
JQuery, as the name implies, isJavaScript and Queries (Query), which is a library of auxiliary development. is the followingPrototype after another excellentJavaScript framework. It swept like a blizzardWeb front-end development,jquery has been identified asASP. NET MVC andThe official part of the Visual Studio 2008 release, Nokia Mobile platformWeb Run-time will also incorporateJquery. So, please believe that the choicejquery is not wrong. If you see any hesitation here, then I'll say one more reason, and I should be able to dispel your last doubts.2009DecemberTiobe programming language RankingsJavaScript rose to the first8, and ranked in the strongest-rising language3 bits. 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 deeplyWeb applications. And as the excellentJavaScript framework, and its prospects are not to be doubted. Unless there is a morejquery More BullB, more excellent stuff.
I'm not going to write a tutorial like thatThe basic usage of jquery is listed, which is 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 ofAPI help documentation is essential and at the very end providesJquery-1.2.6.chm download, need to pick up.
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 ().
Having learned the above,Another surprise that jquery brings to us is that its API supports a variety of mainstream browsers, so you don't have to worry about your hair for IE,Firefox and other compatibility issues. 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.

$ (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:

. 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>

Do you have some knowledge of jquery? Next time we continue our discussion. Click to download: Jquery-1.2.6.chm

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.