简体   繁体   English

如何在Laravel刀片模板系统的下拉列表中添加属性ID?

[英]How to add attribute ID in drop down for laravel blade template system?

I am using Laravel and to get drop down in view, I am using {{ Form::select('state', array(<values>)); }} 我正在使用Laravel,并使用下拉菜单, {{ Form::select('state', array(<values>)); }} {{ Form::select('state', array(<values>)); }} and this is result in a dropdown with an array of values mentioned in . {{ Form::select('state', array(<values>)); }} ,这会导致下拉列表中包含提及的值数组。 It name attribute value will be "state" since it is mentioned in Form. 由于在表单中已提及,因此name属性值将为“状态”。 But how to add ID attribute to access it using jquery? 但是如何添加ID属性以使用jquery访问它呢?

pass the extra attributes in 4th paremeter, third is default selection option which is null in your case. 在第四个参数中传递额外的属性,第三个是默认选择选项,在您的情况下为null。

try this 尝试这个

{{ Form::select('state', array(<values>), null,array('id' => 'selectID')); }}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM