0.0.2 • Published 11 years ago
bootstrip-button v0.0.2
bootstrip-button
Twitter bootstrap button without jQuery
All credit goes to the devs of bootstrap as this is heavily based on the button plugin from it
Install
$ npm install --save bootstrip-buttonTests
$ npm testExample
var Button = require('bootstrip-button')
var $ = require('dom')
var ele = $('.btn-biscuits')
var button = new Button(ele, {
loadingText: 'submitting...'
})
ele.on('click', function(e) {
// set state to loading
button.loading()
setTimeout(function() {
// reset state
button.reset()
}, 600)
})API
Button(ele, opts)
- ele The selector for the ele
- opts (optional)
- object:
{ loadingText: 'loading...' } - string:
loading...
- object:
Button.prototype.toggle()
Toggles the button between loading and reset states
Button.prototype.loading()
Sets the button state to loading if it is not already that
Button.prototype.reset()
Sets the button state to reset if it is not already that
Button.prototype.val()
Gets the correct value for the button element. If it is an input, it returns the value attribute, otherwise, it returns the elements innerHTML
License MIT
Licensed under the MIT license. For more info, see LICENSE
0.0.2
11 years ago
