How set null to first option in Laravel 5 blade

心不动则不痛 提交于 2019-12-11 12:42:22

问题


here is laravel blade selectyears which generates select from 2013 to 2015 and need set first option to null.

{!! Form::selectYear('year', 2013, 2015) !!}

回答1:


Just have another array array(''=>"Select Year") in your select

I guess that you need null because you might need to place some text like Select Year like that.

Here is What you need

{!! Form::select('year', range(2013, 2015) + array(''=>"Select Year")) !!}


来源:https://stackoverflow.com/questions/33709528/how-set-null-to-first-option-in-laravel-5-blade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!