如何通过使用jQuery更改引导按钮样式 [英] How to change bootstrap button style by use jQuery

查看:165
本文介绍了如何通过使用jQuery更改引导按钮样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<a class="btn btn-small btn-block btn-warning" type="button" id="999">&nbsp;</a>

按钮样式为 http://getbootstrap.com/2.3.2/base- css.html#buttons

我想通过使用jQuery来更改"btn-danger"或"btn-info"之类的样式...我认为需要删除样式并添加新的样式...

I want to change the style such as "btn-danger" or "btn-info" by use jQuery...I think need to remove style and add new...

操作方法.谢谢.

推荐答案

@asdf_enel_hak答案将为您服务,但如果要使用jquery一次删除多个类,请执行以下操作:

@asdf_enel_hak answer will work for you but if want to remove multiple classes at once with jquery do as :

$("#999").removeClass("btn-warning btn-block").addClass("btn-info");

或想一次添加多个类,然后执行:

or want to add multiple classes at once then do :

$("#999").removeClass("btn-warning btn-block").addClass("btn-info btn-danger");

有关 .addClass() 查看全文

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