2015-11-15 19 views
0

我發現jQuery DataPicker(http://trentrichardson.com/examples/timepicker/#slider_examples)。DataPicker jQuery不能在MVC中使用@ Html.EditorFor ASP.net

但它不能用@ 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> 

回答

1

您試圖通過id(#basic_example_1)訪問第二個示例,同時給它一個類。所以嘗試使用:

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