Socket
Socket
Sign inDemoInstall

bootstrip-button

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bootstrip-button

button plugin for bootstrip


Version published
Maintainers
1
Install size
31.0 kB
Created

Readme

Source

bootstrip-button

browser support

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-button

Tests

$ npm test

Example

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...

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

Keywords

FAQs

Last updated on 04 Jul 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc