使用 CrossRider,我想向DatePicker
页面的 DOM 添加一个,这是我的代码:
appAPI.ready(function($) {
appAPI.dom.addRemoteCSS('http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css');
appAPI.dom.addRemoteJS('http://code.jquery.com/ui/1.9.2/jquery-ui.js');
$('<input type="text" id="datepicker" />').prependTo($('body'), function(){$( "#datepicker" ).datepicker();});
});
但是没用,我也试过
appAPI.ready(function($) {
appAPI.dom.addRemoteCSS('http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css');
appAPI.dom.addRemoteJS('http://code.jquery.com/ui/1.9.2/jquery-ui.js');
$('<input type="text" id="datepicker" />').prependTo($('body'));
$( "#datepicker" ).datepicker();
});
它也没有用,我试过了
appAPI.ready(function($) {
appAPI.dom.addRemoteCSS('http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css');
appAPI.dom.addRemoteJS('http://code.jquery.com/ui/1.9.2/jquery-ui.js');
$('<input type="text" id="datepicker" />').prependTo($('body'));
$('<script>$(function(){$("#datepicker").datepicker();});</script>').appendTo('head');
});
但是它们都不起作用,同时如果我们在简单页面上测试它会起作用吗?!例如:
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>$(function(){$("#datepicker").datepicker();});</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
如何使用 CrossRider 使日期选择器工作?