我正面临这个问题,只是通过切换它们中的任何一个来做我的工作。
实际上我的基本模板已经在jquery 1.6.2编码,现在我正在使用一些其他的jquery函数是基于1.9.1库的函数是这样的:
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<SCRIPT language="javascript">
$(function () {
$(":checkbox").change(function () {
// Toggle class of selected row
$(this).parent().toggleClass("rowSelected");
// Get all items name, sum total amount
var sum = 1500;
var arr = $(":checkbox:checked").map(function () {
sum += Number($(this).parents('tr').find('td:last').text());
return $(this).parents('tr').clone();
}).get();
// Display selected items and their sum
$("#selectedServices").html(arr).find('input').remove();
$("#total").text(sum);
});
});
</script>
由于1.6.2不支持这个函数,当我同时使用1.9.1和1.6.2时,像这样
<head>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
只有1.6.2支持的功能工作,在删除1.6.2时,控制台显示错误,1.9.1支持的功能(如上所述)工作正常我想让它们支持的所有功能一起工作。怎么办?
你最好只使用jquery 1.9.1(或更新版本)。
然后更新你所有的脚本/函数,使用jquery迁移,这将让你知道在你的代码中要改变什么:http://blog.jquery.com/2013/05/01/jquery-migrate-1-2-0-released/