btn-group中的Bootstrap重置按钮 [英] Bootstrap Reset Button in btn-group

查看:102
本文介绍了btn-group中的Bootstrap重置按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用btn组中的Bootstrap按钮.

I'm using Bootstrap buttons which i have in a btn-group.

<div class="btn-group">
     <button type="button" class="btn  "data-toggle="button">Item1</button>
     <button type="button" class="btn  "data-toggle="button">Item2</button>
</div>

因此,目前(当我使用数据切换时),当按下按钮时,它将进入高亮显示模式.我现在想要一个清除按钮,当点击该按钮时,我希望将按钮重置.我已经阅读了手册,看到必须使用:$().button('reset')

So at the moment (as i'm using data-toggle), when a button is pressed it goes into a highlighted mode. I now want a clear button, when that is tapped I would like the buttons to be reset. I've read the manual and see I have to use: $().button('reset')

但是它只是不起作用.有人可以帮忙提供一个例子.

However its just not working. Could someone please help with an example.

推荐答案

很简单...您需要调用的只是:

It's simple... All you need to call is:

$('.btn-group button').removeClass('active');

从本质上讲,这就是代码在切换时的作用.

This is essentially what the code does when you toggle it.

这篇关于btn-group中的Bootstrap重置按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆