我正在使用“nex/yii2-chosen”,我們如何在下面的示例中添加“class”屬性或“data-*”<?=$form->field($model, "vehicle_id")->widget(Chosen::className(), [ 'items' => $VehicleList, 'disableSearch' => 5, 'class' => 'vehicle_id form-control input-sm', <---------------not working 'clientOptions' => [ 'search_contains' => true, 'single_backstroke_delete' => false, ]]) ?>
1 回答

蝴蝶不菲
TA貢獻1810條經驗 獲得超4個贊
您只需要將它們放在options財產中即可。
<?=
$form->field($model, "vehicle_id")->widget(Chosen::className(), [
'items' => $VehicleList,
'disableSearch' => 5,
'options' => [
'class' => 'vehicle_id form-control input-sm',
],
'clientOptions' => [
'search_contains' => true,
'single_backstroke_delete' => false,
]
]) ?>
- 1 回答
- 0 關注
- 110 瀏覽
添加回答
舉報
0/150
提交
取消