WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Bootstrap JS Button


JS Button (button.js)

Use this plugin if you want to have more control over your buttons.

For a tutorial about Buttons, read our Bootstrap Buttons Tutorial.


The Button Plugin Classes

The classes below can be used to style any <a>, <button>, or <input> element:

Class Description Example
.btn We can add basic styling to any button Try it
.btn-default We can indicates a default/standard button Try it
.btn-primary We can provides extra visual weight and identifies the primary action in a set of buttons Try it
.btn-success We can Indicates a successful or positive action Try it
.btn-info We can Contextual button for informational alert messages
.btn-warning We can Indicates caution should be taken with this action Try it
.btn-danger We can Indicates a dangerous or potentially negative action Try it
.btn-link Makes a button look like a link (will still have button behavior) Try it
.btn-lg Makes a large button Try it
.btn-sm Makes a small button Try it
.btn-xs Makes an extra small button Try it
.btn-block Makes a block-level button (spans the full width of the parent element) Try it
.active Makes the button appear pressed Try it
.disabled Makes the button disabled Try it

Via JavaScript

Enable manually with:

$('.btn').button();

Button Options

None

Button Methods

The below table lists all available button methods.

Method Description Try it
.button("toggle") Makes the button look pressed Try it
.button("loading") Disables the button and changes the button text to "loading..." Try it
.button("reset") Changes the button text to original text (if changed) Try it
.button("string") Specifies a new button text Try it

Examples

Using CSS to Customize Buttons

How to remove the rounded borders:

Example

.btn-default {
    border-radius: 0;
}
Try it Yourself »

How to add a specific color:

Example

.btn-default {
    background: #000;
    color: #f4f142;
}

.btn-default:hover {
    background: #f4f142;
    color: #000;
}
Try it Yourself »

How to add shadows:

Example

.btn-default {
    box-shadow: 1px 2px 5px #000000;
}
Try it Yourself »