我想在对话框模式下打开jQueryMobile日期框。我正在尝试将日期框设置为默认值,但由于某些原因它不会采用它。这里是我的代码:jQueryMobile Datebox不会采用默认日期值 - 尝试所有内容
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@PageData["Title"]</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<link rel="stylesheet" type="text/css" href="http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.css" />
<link rel="stylesheet" href="@Href("/Styles/theme/mysite.min.css")" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<script src="http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.js"></script>
<script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/i8n/jquery.mobile.datebox.i8n.en.js"></script>
</head>
<body>
<script type="text/javascript">
$('document').ready(function(){
//Setting start date value on pageload
$('#myqdate').value('2012-01-14');
$('#myqdate').datebox('refresh');
}
</script>
<form name="shiftform" id="shiftform" action="@Href("~/Account/QChanges.cshtml")" method="post">
<div data-role="fieldcontain">
<label for="myqdate">Date:</label>
<input name="myqdate" id="myqdate" type="date" value="" data-role="datebox" data-options='{"mode": "flipbox", "forceInheritTheme": true, "defaultDate":"2012-01-14"}'>
</div>
<input type="submit" value="Get Queue"/>
</form>
</body>
</html>
我真的很感谢专家的帮助。
感谢
非常感谢离子,我应该在哪里放置这行代码?我应该用我的代码替换这个东西吗? – user1142216 2012-01-14 18:26:24
替换 '$('#myqdate')。value('2012-01-14'); $('#myqdate')。datebox('refresh');'带上面的代码。 – 2012-01-15 13:58:38
这也没有工作离子。但我尝试了一些非常简单的方法,它似乎可行。我完全删除了自定义JavaScript代码,并简单地将日期框代码更改为: – user1142216 2012-01-15 18:01:17