robloach / jquery-once
Act on jQuery elements only once.
Installs: 593
Dependents: 0
Suggesters: 0
Security: 0
Stars: 61
Watchers: 8
Forks: 20
Open Issues: 0
Language:JavaScript
Type:component
Requires
- dev-master
- 2.3.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-beta.3
- 2.0.0-beta.2
- 2.0.0-beta.1
- 2.0.0-alpha.9
- 2.0.0-alpha.8
- 2.0.0-alpha.6
- 2.0.0-alpha.5
- 2.0.0-alpha.4
- 2.0.0-alpha.3
- 2.0.0-alpha.2
- 2.0.0-alpha.1
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.1
- 1.2.0
- dev-prepare-2.3.0
- dev-update-dev-deps
- dev-docs-david-greenkeeper
- dev-workflows
- dev-greenkeeper/xo-0.29.0
- dev-greenkeeper/xo-0.28.3
- dev-greenkeeper/xo-0.28.2
- dev-greenkeeper/jsdom-16.2.2
- dev-greenkeeper/xo-0.28.0
- dev-greenkeeper/xo-0.27.2
- dev-greenkeeper/xo-pin-0.27.0
- dev-greenkeeper/xo-0.27.1
- dev-greenkeeper/xo-0.26.1
- dev-nodejstest
- dev-greenkeeper/xo-pin-0.25.4
- dev-greenkeeper/xo-0.26.0
- dev-coveralls
- dev-changelog-2.2.3
This package is auto-updated.
Last update: 2024-11-05 00:12:10 UTC
README
Act on jQuery elements only once.
Filters out all elements that had the same filter applied on them before. It can be used to ensure that a function is only applied once to an element.
Install
Usage
See the API documentation for more information on how to use jQuery Once.
// The following will change the color of each paragraph to red, just once // for the "changecolor" key. $('p').once('changecolor').css('color', 'red'); // .once() will return a set of elements that yet to have the once ID // associated with them. You can return to the original collection set by // using .end(). $('p') .once("changecolorblue") .css("color", "blue") .end() .css("color", "red"); // To execute a function on the once set, you can use jQuery's each(). $('div.calendar').once().each(function() { // Since there is no once ID provided here, the key will be "once". });
Development
- Ensure you are using node >= 4:
node --version
- Install dependencies through npm:
npm install
- Check coding style standard, and automated testing:
npm test
- Build
jquery.once.min.js
with:
npm run build
- Update API documentation:
npm run docs
- Tag and publish the new versions to npm with Semantic Versioning:
git add -A
git commit -m "2.3.0"
git tag 2.3.0
git push origin 2.3.0
npm publish
Change Log
Discover the change history by heading on over to the CHANGELOG.md
file.
License
Dual licensed under:
- GPL-2.0
- the incredibly permissive MIT license
Copyright © Rob Loach