微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Bootstrap4切换开关按钮显示为复选框

如何解决Bootstrap4切换开关按钮显示为复选框

我要制作switch button,但是显示的像checkBox。紧跟this article bootstrap4-toggle

我的按钮应该看起来像这样

enter image description here

但是看起来像这样

enter image description here

添加了参考链接

<link href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>

我也有安装库

npm install bootstrap4-toggle

这是我的代码

<input type="checkBox" checked data-toggle="toggle" data-size="lg">
<input type="checkBox" checked data-toggle="toggle">
<input type="checkBox" checked data-toggle="toggle" data-size="sm">
<input type="checkBox" checked data-toggle="toggle" data-size="xs">

如何解决此问题?

解决方法

bootstrap4-toggle需要jQuery。添加一个jQuery CDN以及参考链接。例如,在您的head标签内添加以下CDN。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。