jQuery Migrate plugin usage

jQuery Migrate plugin uses
jQuery Migrate application migration auxiliary plug-in version is compatible low-level version for advanced auxiliary plug.
For example, using a jQuery version 1.x, plans to upgrade to 3.x, you can delete the 1.x version of the page, and replaced with version 3.x, if there is a script error,
on the introduction of jquery-migrate compatible plug-in for low version , but also shows low alternative version of the method to program a new version of the method.


example:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>test</title>		
	<script type="text/javascript" src="jquery-1.6.1.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
	  $("button").click(function(){
		alert($("li").size());
	  });
	});
	</script>
</head>
<body>
<button>测试按钮</button>
<ul>
<li>Coffee</li>
<li>Milk</li>
<li>Soda</li>
</ul>
</body>
</html>

Click the button to bring up the "3."

The <script type = "text / javascript " src = "jquery-1.6.1.js"> </ script>
Replace <script type = "text / javascript " src = "jquery-3.3.1.js"> < / script>
then click on the button to display script errors in Chrome browser developers window:
$ (...) A size iS not function.


Page reintroduction <script src = "jquery-migrate -3.0.1.js"> </ script>
click on the button, the pop-up normal "3."
Also suggest using the length size method is deprecated in place:
jQuery.fn.size () IS deprecated and removed; .length The use Property


The $ ( "li"). Size () into $ ( "li"). Length , removing jquery-migrate-3.0.1.js, click the button, pop-up "3."
Migration method is complete.

Guess you like

Origin blog.csdn.net/gdjlc/article/details/90411625