简体   繁体   English

更改Yii2中的复选框图标

[英]Change checkbox Icon in Yii2

How can I change the checkbox icon when it's checked in Yii2? 在Yii2中选中复选框图标后,如何更改? For now, I add checkbox in the div and inside it, I add an icon: <i class="fa fa-check-circle icon-check-circle"></i> but it shows the checkbox check symbol how can I change it to my preferred icon? 现在,我在div中添加复选框,并在其中添加图标: <i class="fa fa-check-circle icon-check-circle"></i>但是它显示了复选框的选择符号更改为我的首选图标? Thanks. 谢谢。

<div class="box-div-buttontoadd">
    <i class="fa fa-check-circle icon-check-circle"></i>
    <div class="div_row buttons hidden-xs">
        <?= $form->field($model,'addedToCard')->checkbox([
            'id' => 'products-addedtocard-'. $model->id,
            'class' => 'addedtocard-chk'
        ]); ?>
    </div>
</div>

Is it possible to use font awesome icon instead of checkbox tick symbol? 是否可以使用字体超赞图标代替复选框打勾符号?

You should try to change icon with CSS, there is a plenty examples like this Just don't forget to use the element class what is .addedtocard-chk in your example, or just the simple input[type="checkbox"] . 你应该尝试改变图标,CSS,有像很多例子只是不要忘记使用元素类是什么.addedtocard-chk在你的榜样,或者只是简单的input[type="checkbox"] Be sure to get the FontAwesome CSS and place it in your project folder. 确保获取FontAwesome CSS并将其放置在项目文件夹中。

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

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