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.