jQuery Once
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
Method | Installation |
---|
npm | npm install jquery-once --save |
Composer | composer require robloach/jquery-once |
Bower | bower install jquery-once |
Component | component install RobLoach/jquery-once |
jsDelivr | //cdn.jsdelivr.net/npm/jquery-once@2.3.0/jquery.once.min.js |
cdnjs | //cdnjs.cloudflare.com/ajax/libs/jquery-once/2.3.0/jquery.once.js |
Usage
See the API documentation for more information on how to use jQuery Once.
$('p').once('changecolor').css('color', 'red');
$('p')
.once("changecolorblue")
.css("color", "blue")
.end()
.css("color", "red");
$('div.calendar').once().each(function() {
});
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:
Copyright © Rob Loach