【问题标题】:How to display a datepicker on a page in laravel?如何在 laravel 的页面上显示日期选择器?
【发布时间】:2015-05-13 02:52:52
【问题描述】:

我使用以下代码来显示日期选择器。 但是当我在 Firefox 上运行应用程序时,我找不到日期选择器。 我正在使用 Laravel4.2。 有没有最好的方法来显示日期选择器? 是否有任何可用的 CDN 来执行此操作?

<table class="table table-striped">
    <thead>
    <tr>
        <th>
        	{{ Form::label('select','Select an event :') }}
           <select class="form-control input" name="events" id="events" >
            <option selected disabled value="00">Select</option>
                <option value="1">Clicks</option>
                <option value="2">Views</option>
                <option value="3">Loads</option>
                <option value="4">Opens</option>
            </select>
            </th>
            <th>
            	{{ Form::label('s_date','From :') }} 
        		<input type="date" class="form-control" required id="dp" name="start_date"/>
            </th>
            <th>
            	{{ Form::label('t_date','To :') }} 
        		<input type="date" class="form-control" required id="dp" name="to_date"/>
        	</th>
        	<th>
        		<input type="button" value="View report" class="btn btn-primary" onclick="displayVals()">
        	</th>
     </tr>
    </thead>
</table>
<div id="performance">
   
</div>

【问题讨论】:

  • 运行您的代码 sn-p 您的日期选择器显示正常。您必须单击下拉菜单。尝试点击输入表格。日历将显示。 PS 确保你的 laravel 视图以 .blade.php 结尾。
  • 我工作,但只在谷歌浏览器上工作,我也在 Linux 上工作。

标签: javascript jquery laravel-4 datepicker


【解决方案1】:

见bootstrap-datepickerhttp://eternicode.github.io/bootstrap-datepicker/

添加标记:

<div id="sandbox-container">
    <input type="text" type="text" class="form-control">
</div>

添加脚本:

$('#sandbox-container input').datepicker({

});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-27
    • 1970-01-01
    • 1970-01-01
    • 2014-01-09
    • 1970-01-01
    相关资源
    最近更新 更多