[英]ASP.NET MVC 5 @Html.EditorFor and javascript datepicker
[英]DataPicker jQuery doesn't work with @Html.EditorFor in MVC ASP.net
我找到了jQuery DataPicker( http://trentrichardson.com/examples/timepicker/#slider_examples )。
但這不適用於@ HTML.EditorFor,為什么?
@*working*@
<input type="text" name="basic_example_1" id="basic_example_1" value="">
@*not working*@
@Html.EditorFor(model => model.eventstart, new { htmlAttributes = new { @class = "basic_example_1" } })
<script>
$('#basic_example_1').datetimepicker($.timepicker.regional['pl']);
</script>
在給第二個示例提供類的同時,您嘗試通過其ID(#basic_example_1)訪問第二個示例。 因此,嘗試使用:
$('.basic_example_1').datetimepicker($.timepicker.regional['pl']);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.