I'm trying to add a class to form file input in yii2, but it doesn't seem to work.
I'm trying to add .cropit-image-input
to this form element.
<?= $form->field($model, 'profile_picture_url')->fileInput() ?>
You can add class property of element like following:
<?= $form
->field($model, 'profile_picture_url')
->fileInput(['class'=>'cropit-image-input'])
?>
You can add class to fileInput()
like any normal input.
For Example,
<?= $form->field($model, 'profile_picture_url')->fileInput(['class' => 'cropit-image-input form-control']) ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.