PHPackages                             robloach/jquery-once - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. robloach/jquery-once

ActiveComponent[Utility &amp; Helpers](/categories/utility)

robloach/jquery-once
====================

Act on jQuery elements only once.

2.3.0(2y ago)593.3k↑86.7%18MITJavaScriptCI passing

Since Apr 5Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/RobLoach/jquery-once)[ Packagist](https://packagist.org/packages/robloach/jquery-once)[ Docs](http://github.com/robloach/jquery-once)[ RSS](/packages/robloach-jquery-once/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (1)Versions (47)Used By (0)

jQuery Once [![NPM version](https://camo.githubusercontent.com/d5162ae0cf14dadbd8d343dc6cec5684e4b45ff6f3bf0c65d72b26a659161ac2/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f6a71756572792d6f6e63652e737667)](https://npmjs.org/package/jquery-once "View this project on NPM")
============================================================================================================================================================================================================================================================================================

[](#jquery-once-)

[![Testing](https://github.com/RobLoach/jquery-once/workflows/tests/badge.svg)](https://github.com/RobLoach/jquery-once/workflows/tests/badge.svg)[![NPM downloads](https://camo.githubusercontent.com/256445bb7457a83b9fa339d2c462c99999bbcf13a02c79eefd28c7c168142066/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f646d2f6a71756572792d6f6e63652e737667)](https://npmjs.org/package/jquery-once "View this project on NPM")

> Act on [jQuery](http://jquery.com) 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
-------

[](#install)

MethodInstallation[npm](http://npmjs.com/package/jquery-once)`npm install jquery-once --save`[Composer](https://packagist.org/packages/robloach/jquery-once)`composer require robloach/jquery-once`[Bower](http://bower.io/search/?q=jquery-once)`bower install jquery-once`[Component](https://github.com/componentjs/component)`component install RobLoach/jquery-once`[jsDelivr](http://www.jsdelivr.com/#!jquery.once)`//cdn.jsdelivr.net/npm/jquery-once@2.3.0/jquery.once.min.js`[cdnjs](https://cdnjs.com/libraries/jquery-once)`//cdnjs.cloudflare.com/ajax/libs/jquery-once/2.3.0/jquery.once.js`Usage
-----

[](#usage)

[See the API documentation for more information on how to use jQuery Once.](https://github.com/RobLoach/jquery-once/blob/master/API.md#readme)

```
// 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
-----------

[](#development)

1. Ensure you are using [node](http://nodejs.org) &gt;= 4:

```
node --version

```

2. Install dependencies through [npm](http://npmjs.org):

```
npm install

```

3. Check coding style standard, and automated testing:

```
npm test

```

4. Build `jquery.once.min.js` with:

```
npm run build

```

5. Update API documentation:

```
npm run docs

```

6. Tag and publish the new versions to [npm](http://npmjs.com) with [Semantic Versioning](http://semver.org/):

```
git add -A
git commit -m "2.3.0"
git tag 2.3.0
git push origin 2.3.0
npm publish

```

Change Log
----------

[](#change-log)

[Discover the change history by heading on over to the `CHANGELOG.md` file.](CHANGELOG.md)

License
-------

[](#license)

Dual licensed under:

- [GPL-2.0](http://opensource.org/licenses/gpl-2.0.php)
- the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT license](http://opensource.org/licenses/MIT)

Copyright © [Rob Loach](http://github.com/RobLoach)

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance53

Moderate activity, may be stable

Popularity37

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 87.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~145 days

Recently: every ~598 days

Total

28

Last Release

956d ago

Major Versions

1.2.6 → 2.0.0-alpha.12014-09-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25086?v=4)[Rob Loach](/maintainers/RobLoach)[@RobLoach](https://github.com/RobLoach)

---

Top Contributors

[![RobLoach](https://avatars.githubusercontent.com/u/25086?v=4)](https://github.com/RobLoach "RobLoach (247 commits)")[![greenkeeper[bot]](https://avatars.githubusercontent.com/in/505?v=4)](https://github.com/greenkeeper[bot] "greenkeeper[bot] (26 commits)")[![theodoreb](https://avatars.githubusercontent.com/u/292904?v=4)](https://github.com/theodoreb "theodoreb (4 commits)")[![olavorn](https://avatars.githubusercontent.com/u/3752407?v=4)](https://github.com/olavorn "olavorn (2 commits)")[![JohnAlbin](https://avatars.githubusercontent.com/u/33429?v=4)](https://github.com/JohnAlbin "JohnAlbin (1 commits)")[![LukasDrgon](https://avatars.githubusercontent.com/u/15611832?v=4)](https://github.com/LukasDrgon "LukasDrgon (1 commits)")

### Embed Badge

![Health badge](/badges/robloach-jquery-once/health.svg)

```
[![Health](https://phpackages.com/badges/robloach-jquery-once/health.svg)](https://phpackages.com/packages/robloach-jquery-once)
```

###  Alternatives

[eternicode/bootstrap-datepicker

A datepicker for Bootstrap

12.7k552.0k6](/packages/eternicode-bootstrap-datepicker)[vakata/jstree

jsTree is jquery plugin, that provides interactive trees.

5.2k1.8M11](/packages/vakata-jstree)[eonasdan/bootstrap-datetimepicker

Date/time picker widget based on twitter bootstrap

7.2k500.2k9](/packages/eonasdan-bootstrap-datetimepicker)[nicolaskruchten/pivottable

Javascript Pivot Table (aka Pivot Grid, Pivot Chart, Cross-Tab) implementation with drag'n'drop.

4.4k223.4k1](/packages/nicolaskruchten-pivottable)[mottie/tablesorter

tablesorter (FORK) is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.

2.6k234.4k](/packages/mottie-tablesorter)[components/jqueryui

jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.

1775.9M61](/packages/components-jqueryui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
