【问题标题】:DataPicker jQuery doesn't work with @Html.EditorFor in MVC ASP.netDatePicker jQuery 不适用于 MVC ASP.net 中的 @Html.EditorFor
【发布时间】:2015-11-15 13:29:00
【问题描述】:

我找到了 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>

【问题讨论】:

    标签: javascript jquery asp.net-mvc datepicker


    【解决方案1】:

    您正在尝试通过 id (#basic_example_1) 访问第二个示例,同时给它一个类。所以尝试使用:

    $('.basic_example_1').datetimepicker($.timepicker.regional['pl']);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-17
      • 1970-01-01
      • 2012-10-17
      • 1970-01-01
      • 2014-07-01
      • 2013-02-10
      • 1970-01-01
      相关资源
      最近更新 更多