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.