[英]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.