admin管理员组文章数量:1332353
I'm trying to create a TimePicker with Razor and JQueryUI in my bootstrap web. I created a DatePicker, and I know that I could create a DateTimePicker with JQuery, but I don't want to select the date and the time together, I want to select it with two different TextBox.
So I saw many tutorials, but all of them create a DateTimePicker, and when I tried to create a TimePicker with the same format, that didn't worked for me.
This is my code:
JavaScript:
<link rel="stylesheet" href=".11.3/themes/smoothness/jquery-ui.css" type="text/css" />
<script src=".10.2.js"></script>
<script src=".11.3/jquery-ui.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#datepicker').datepicker({
showOptions: { speed: 'fast' },
changeMonth: false,
changeYear: false,
dateFormat: 'dd/mm/yy',
gotoCurrent: true
});
$('#timepicker').timepicker();
});
</script>
I'm trying to create a TimePicker with Razor and JQueryUI in my bootstrap web. I created a DatePicker, and I know that I could create a DateTimePicker with JQuery, but I don't want to select the date and the time together, I want to select it with two different TextBox.
So I saw many tutorials, but all of them create a DateTimePicker, and when I tried to create a TimePicker with the same format, that didn't worked for me.
This is my code:
JavaScript:
<link rel="stylesheet" href="https://code.jquery./ui/1.11.3/themes/smoothness/jquery-ui.css" type="text/css" />
<script src="http://code.jquery./jquery-1.10.2.js"></script>
<script src="https://code.jquery./ui/1.11.3/jquery-ui.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#datepicker').datepicker({
showOptions: { speed: 'fast' },
changeMonth: false,
changeYear: false,
dateFormat: 'dd/mm/yy',
gotoCurrent: true
});
$('#timepicker').timepicker();
});
</script>
Razor and Html:
@using (Html.BeginForm())
{
@Html.TextBox("date", DateTime.Now.ToShortDateString(), new { @id = "datepicker", @readonly = "readonly", @style = "width:250px;" })
<br />
@Html.TextBox("time","-- Select Time --", new { @id = "timepicker", @readonly = "readonly", @style = "width:250px;" })
}
Thanks! :)
Share Improve this question asked Apr 11, 2016 at 7:44 Estel_RebelEstel_Rebel 431 gold badge1 silver badge6 bronze badges 1- TypeError: $(...).timepicker is not a function – Estel_Rebel Commented Apr 11, 2016 at 7:54
1 Answer
Reset to default 4jQuery-UI addon is required for timepicker control.
check here : https://jsfiddle/dmc55erf/8/
<link rel="stylesheet" href="https://code.jquery./ui/1.11.3/themes/smoothness/jquery-ui.css" type="text/css" />
<script src="https://code.jquery./jquery-2.2.2.js"></script>
<script src="https://code.jquery./ui/1.11.3/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/jquery-timepicker/1.8.1/jquery.timepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare./ajax/libs/jquery-timepicker/1.8.1/jquery.timepicker.min.css" type="text/css" />
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#datepicker').datepicker({
showOptions: { speed: 'fast' },
changeMonth: false,
changeYear: false,
dateFormat: 'dd/mm/yy',
gotoCurrent: true
});
$('#timepicker').timepicker();
});
</script>
本文标签: javascriptTimePicker Razor ASPNETMVCStack Overflow
版权声明:本文标题:javascript - TimePicker Razor ASP.NET-MVC - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742321386a2452856.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论