laravel使用twitter bootstrap和datepicker [英] laravel using twitter bootstrap and datepicker

查看:495
本文介绍了laravel使用twitter bootstrap和datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试以laravel标签创建的形式呈现一个日期戳。到目前为止,除了正常的文本字段之外,没有其他的显示。

I am trying to render a datepicker in the form created by laravel tags. So far, nothing else is showing except a regular text field.

我已经使用了这个为datepicker。我以下面的形式:

I've used this for the datepicker. And I did the below in the form:

<p>{{ Form::text('dob', '', array('class' => 'form-control','placeholder' => 'تاريخ الميلاد', 'data-datepicker' => 'datepicker')) }}</p>

尽管如此,我只是这样:

Nonetheless, I am only getting this:

这里有什么建议?我也添加了css和js到标题,所以都应该到位。

What is the recommendation here? I also added the css and js to the header so all should be in place.

谢谢,

更新:在footer.blade.php中调用datepicker js函数,其中所有其他调用:

Update: calling datepicker js function in the footer.blade.php where all other calls are:

{{ HTML::script('/public/assets/js/bootstrap-typeahead.js') }}
{{ HTML::script('/public/assets/js/bootstrap-datepicker.js') }}

<script>
    $('.datepicker').datepicker()
</script>

这仍然没有改变任何东西。

This still didn't change anything.

推荐答案

使用id初始化datepicker

Use an id to initialize the datepicker

{!! Form::input('date', 'dob', date('d-m-Y'), ['class' => 'form-control', 'id' => 'dob', 'data-date-format' => "dd-mm-yyyy"]) !!}

并使用此javascript

and use this javascript

$('#dob').datepicker();

这篇关于laravel使用twitter bootstrap和datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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