BootStrap DatePicker弹出两次 [英] BootStrap DatePicker popped twice

查看:199
本文介绍了BootStrap DatePicker弹出两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文本框中应用了引导日期选择器,但是无论何时用户选择任何日期或月份.弹出另一个日历.

i applied a bootstrap datepicker on Text box, but whenever user select any Date or month. Another calendar popped out .

查看:

<div class="input-append date" id="datepicker" data-date-format="dd-mm-yyyy">
@Html.TextBoxFor(x => x.Dob, new { @value = String.Empty, @readonly = true })
<span class="add-on"><i class="icon-calendar"></i></span>
</div>

型号:

 [DisplayName(@"DOB")]
 [DataType(DataType.Date)]
 public DateTime Dob { get; set; }

jQuery:

<script type="text/javascript">
    $(document).ready(function () {

        //Set The dateTime Calender for datepicker
        $('#datepicker').datepicker({

            todayHighlight: true,
        });
</script>

推荐答案

请检查是否已为DateTime定义了custom editor Templates,然后在其中设置类.datepicker.可能您正在对压延机控件进行明确的重复初始化.

Please check , if you have defined a custom editor Templates for DateTime, and setting the class .datepicker there. its possible you are doing explicit duplicate initialization of calender control.

在使用引导程序时,bootstrap-datepicker.js会初始化所有具有.datepicker类的节点,而无需显式指令.

As you are using bootstrap ,bootstrap-datepicker.js initializes the all nodes which has .datepicker class without explicit instruction.

删除函数中的显式初始化.

Remove the explicit initialization in your function.

这篇关于BootStrap DatePicker弹出两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆