jquery-migrate: 迁徙旧的jQuery代码至jQuery1.9以上的版本

jquery-migrate: 迁移旧的jQuery代码至jQuery1.9以上的版本

这个插件可以用来检测和恢复在jQuery1.9版本中已删除或已过时的API,比如常用的live方法

https://github.com/jquery/jquery-migrate/

 

测试页面:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<script src="jquery-1.9.0.js" type="text/javascript"></script>

<script src="jquery-migrate-1.2.1.js" type="text/javascript"></script>

<script type="text/javascript">

$(function(){

$("body").append('<input type="button" class="btn" value="click" />');

$(".btn").live("click",function(){

alert("ss");

$(".btn").die("click");

})

})

</script>

</head>

<body>

</body>

 

</html>