js:
$(".time").timeEntry({ show24Hours: true });html:
<td>@Html.TextBox("TimeFrom", Model.TimeFrom.ToString(), new {@class = "time"})</td> 我看到格式HH:mm:ss,我需要HH:mm

如何做到这一点?
浏览器IE9
我创建了测试视图:
@model DateTime
@{
Layout = null;
}
<link href="@Url.Content("~/Content/themes/base/jquery.timeentry.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery/jquery-1.8.2.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.timeentry.min.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$(".time").timeEntry({ show24Hours: true, showSeconds: false });
});
</script>
@Html.TextBox("TimeFrom", Model.ToString(), new { @class = "time" })只有在获得焦点之后,timeEntry才能发挥作用
我使用的是http://keith-wood.name/timeEntry.html的最新版本
发布于 2013-01-04 17:48:13
是像这样吗?
$(".time").timeEntry({ show24Hours: true, showSeconds: false });发布于 2013-01-04 17:49:55
尝尝这个
$(".time").timeEntry({ show24Hours: true, showSeconds: false });根据docs的说法..在Quick Ref中,您可以看到
showSeconds: false, // True to show seconds as well, false for hours/minutes only 发布于 2013-01-04 20:30:46
您是否已尝试设置初始文本框值的格式?
@Html.TextBox("TimeFrom", Model.ToString("HH:mm"), new { @class = "time" })这对我很管用。
https://stackoverflow.com/questions/14154637
复制相似问题