way2web-click-limit

0.0.3 • Public • Published

Click Limit package

NPM version Downloads

With this package you can set a limit on how many times you can click on the element.

Installation

npm install way2web-click-limit

Basic Usage

var element = $('.js-limited-click:first');
var test = new ClickLimit(element).init();

You can set a data attribute click-max to the element, to set the click limit. The default value is 1, so you can click the element only one time.

.click()

This function will called when you click on the element. A variable clicked will be increased by 1. The property disabled will be set on the element.

.unlock()

You can call this function to reset the clicks on the element, so you can click again on the element. The variable clicked will be set to 0. The property disabled will be removed from the element.

.getClicked()

This function returns how many times you have clicked on the element.

.getMax()

This function returns how many times you can click on the element.

Test the package.

npm run lint This will only lint your scripts.

npm test

This will run all the tests in the test folder with mocha.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    51
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    51
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i way2web-click-limit

Weekly Downloads

51

Version

0.0.3

License

MIT

Last publish

Collaborators

  • paqtcom-cto
  • johanvanhelden
  • tomw2w
  • w3news