Talking about functions abandoned by jQuery and alternative functions _ jquery-js tutorial

Source: Internet
Author: User
This article mainly introduces several functions abandoned by jQuery and their substitution functions. We must pay attention to them during project development and share them with you for your reference. Earlier in order to better browser compatibility, has been the use of jQuery-1.7.2 version; but with the rapid development of the major browsers and technology, even the new version of bootstrap is the need to introduce the version of jQuery-1.9 or above, representing the commonly used jQuery-1.7.2 should also say goodbye to the stage of history;

However, some of our commonly used functions are also discarded. If you don't pay attention to them, all kinds of errors will be reported. Let's check these abandoned functions; of course, if you don't know the discarded functions, you don't need to remember them. You just need to understand their alternative functions; the significance of this article is to remind our friends which functions are discarded and should be replaced by those functions. For the specific method of using the alternative functions, please Gu Ge du Niang.

1: abandon function:. live ()

Abandoned version: jQuery-1.9 or above

Alternative function:. on ()

2: discard function:. die ()

Abandoned version: jQuery-1.9 or above

Alternative function:. off ()

3: abandon function:. size ()

Abandoned version: jQuery-1.8 or above

Alternative function:. length

4: abandon function:. toggle ()

Abandoned version: jQuery-1.8 or above

Alternative function :......

Fortunately, when I wrote this article, I threw this function to the end, because there is no substitute function officially, but there is nothing to block intelligent programmers;

If you want to switch the css style, you can use. toggleClass ();

If you want to switch events, you can use the following custom functions;

Var I = 0; $ ('# test '). click (function () {if (I = 0) {// execution method content I = 1 ;}else {// execution method content I = 0 ;}}

The above is all the content of this article. I hope you will like it.

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.