On the function and substitution function of being discarded by jquery

Source: Internet
Author: User
Tags deprecated

This article mainly introduces some of the functions of jquery discarded and its substitution function, we do in the development of the project must pay attention to, share to everyone reference.

Earlier, the jQuery-1.7.2 version was used for better browser compatibility, but with the rapid development of major browsers and technologies, Even bootstrap new version is the need to introduce more than jQuery-1.9 version, representing the commonly used jQuery-1.7.2 also farewell to the stage of history;

But some of the functions we use are also discarded; if you don't pay attention, you'll be able to make a variety of errors; take stock of the deprecated functions; if you do not recognize these discarded functions; Congratulations you do not need to remember, only need to understand its replacement function; The significance of this article is to remind parents of which functions have been discarded and which functions to replace them, as well as the specific use of alternative functions please Gotodo Niang.

1: Discard function:. Live ()

Deprecated version: jQuery-1.9 or above

Substitution function:. ON ()

2: Discard function:. Die ()

Deprecated version: jQuery-1.9 or above

Override function:. Off ()

3: Discard function:. Size ()

Deprecated version: jQuery-1.8 or above

Override function:. length

4: Discard function:. Toggle ()

Deprecated version: jQuery-1.8 or above

Substitution function: ...

Fortunately, when writing this article to the end of the function, because there is no corresponding substitution function, but there is nothing to stop the intelligent programmer;

If it is used to toggle CSS styles, you can use the. Toggleclass ();

If you are switching events, you can use the following custom functions;


1 2 3 4 5 6 7 8 9 10 var i=0; $ (' #test '). Click (function () {if (i==0) {//Execute method content i=1;} else{//Execution method content i=0}}

The above mentioned is the entire content of this article, I hope you can enjoy.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.