Laravel 4 Blade下拉列表类属性 [英] Laravel 4 blade drop-down list class attribute

查看:78
本文介绍了Laravel 4 Blade下拉列表类属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Laravel刀片下拉列表类属性不起作用.

Laravel blade drop down list class attribute not working.

在文档中找不到任何关于类的引用或分配属性以选择/下拉列表.

I cannot find any reference to class or assigning attributes to select / drop-down lists in the documentation.

http://www.laravel.com/docs/html#drop-down-lists

尝试的示例:

{{ Form::select('product_id', $productList, array('class'=>'form-control')) }}

{{ Form::select('product_id', $productList, $attributes = array('class'=>'form-control')) }}

两者都返回相同的html,但没有class属性:

Both return the same html but without the class attribute:

<select id="product_id" name="product_id">
    ... Option Stuff ...
</select>

推荐答案

{{ Form::select('product_id', $productList, null, array('class' => 'form-control')) }}

第三个参数是当前所选选项的键.默认为空.

The third parameter is the key of the currently selected option. Defaults to null.

这篇关于Laravel 4 Blade下拉列表类属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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