【问题标题】:Having to Datepicker at the same time with Twitter Bootstrap?必须与 Twitter Bootstrap 同时使用 Datepicker?
【发布时间】:2012-05-14 07:06:10
【问题描述】:

当我尝试使用 2 个日期选择器时,只会弹出第一个。 另一个没有 我将代码上传到 http://jsfiddle.net/2ed8T/

<link href="http://aymkdn.github.com/Datepicker-for-Bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="http://github-proxy.kodono.info/?q=https://raw.github.com/Aymkdn/Datepicker-for-Bootstrap/master/datepicker.css" rel="stylesheet">


<div class="input-append date" id="dp2" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
    <input class="span2"  name="date_to" size="16" type="text" value="12-02-2012" readonly>
    <span class="add-on"><i class="icon-th"></i></span>
</div>
<div class="input-append date" id="dp3" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
    <input class="span2"  name="date_to" size="16" type="text" value="12-02-2012" readonly>
    <span class="add-on"><i class="icon-th"></i></span>
</div>

<script src="http://aymkdn.github.com/Datepicker-for-Bootstrap/js/jquery-1.7.1.min.js"></script>
<script src="http://github-proxy.kodono.info/?q=https://raw.github.com/Aymkdn/Datepicker-for-Bootstrap/master/bootstrap-datepicker.js"></script>



<script>        
    $(function(){  
        $('#dp2').datepicker()({
            format: 'mm-dd-yyyy'
        });
        $('#dp3').datepicker()({
            format: 'mm-dd-yyyy'
        });


    });

</script>

【问题讨论】:

    标签: jquery css twitter xhtml twitter-bootstrap


    【解决方案1】:

    .datepicker() 调用中有一组额外的括号。

    应该是$('#dp2').datepicker({...}),而不是$('#dp2').datepicker()({...})

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-30
      相关资源
      最近更新 更多