使用 jquery mobile 的 datepicker ( datepicker )时我遇到了一些问题
当我使用 jQuery 1.5 版本和 jQuery mobile 1.0a4.1 时,日期选择器按预期显示。这是代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="~/Content/jquery.ui.datepicker.mobile.css" rel="stylesheet" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script>
//reset type=date inputs to text
$(document).bind("mobileinit", function () {
$.mobile.page.prototype.options.degradeInputs.date = true;
});
</script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
<script src="~/Scripts/jquery.ui.datepicker.js"></script>
<script src="~/Scripts/jquery.ui.datepicker.mobile.js"></script>
</head>
<body>
@RenderBody()
<div data-role="page">
<div data-role="content">
<p>Hello world</p>
<form action="#" method="get">
<div data-role="fieldcontain">
<label for="date">Date Input:</label>
<input type="date" name="date" id="date" value="" />
</div>
</form>
</div>
</body>
但是当我使用 jQuery 1.9.1 和 jQuery mobile 1.3.1 时,它会产生以下错误:
TypeError: Object [object Object] 没有方法'live' [http://localhost:62799/Scripts/jquery.ui.datepicker.mobile.js:50]
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="~/Content/jquery.ui.datepicker.mobile.css" rel="stylesheet" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
//reset type=date inputs to text
$(document).bind("mobileinit", function () {
$.mobile.page.prototype.options.degradeInputs.date = true;
});
</script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<script src="~/Scripts/jquery.ui.datepicker.js"></script>
<script src="~/Scripts/jquery.ui.datepicker.mobile.js"></script>
</head>
<body>
@RenderBody()
<div data-role="page">
<div data-role="content">
<p>Hello world</p>
<form action="#" method="get">
<div data-role="fieldcontain">
<label for="date">Date Input:</label>
<input type="date" name="date" id="date" value="" />
</div>
</form>
</div>
</body>
有一些解决方法吗?