JQuery1.415 new features you should know

Source: Internet
Author: User
JQuery1.4 has just been released. this version is not a simple improvement. It not only contains many new features, but also improves many functions and makes great effort in performance optimization, this article will discuss these new features and enhancements, hoping to help you. first you can download the latest 1.4 version from here: http://code.jquery.com/jquery-1.4.js

1. Pass attributes to jQuery

In versions earlier than 1.4, jQuery used the "attr" method to add attributes to the element set. The "attr" method can not only pass attribute names and values, you can also pass an object set that contains multiple attributes. In 1.4, apart from creating new objects, it can now pass attribute objects as parameters to jQuery functions or objects themselves. For example, you can create a link element containing multiple attributes. The Code 1.4 is as follows:

JQuery ('',{
Title:'Non-harmonious google Edition',
Text:'Go to Google!'

You may notice the "text" attribute and guess what it is, because tag a does not have the "text" attribute. When you pass certain attributes, jquery 1.4 will also check and use its own method. Therefore, the "text" attribute above allows jQuery to call its ". text ()" method and enter "Google! "As its unique parameter.

Here is a better example:

 JQuery ('

Css :{
Alert ('Foo has been clicked!');

The "id" attribute is added as a common attribute. However, the "css" and "click" attributes correspond to specific jQuery methods. The above code is written as follows before 1.4:

 JQuery ('

. Attr ('Id','Foo')
. Css ({
. Click (Function(){
Alert ('Foo has been clicked!');

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.