Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/felquis/jqueryeachselector
Select multiple elements with complex selectors to do the same action in all
https://github.com/felquis/jqueryeachselector
Last synced: 1 day ago
JSON representation
Select multiple elements with complex selectors to do the same action in all
- Host: GitHub
- URL: https://github.com/felquis/jqueryeachselector
- Owner: felquis
- Created: 2013-01-16T13:01:02.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-12-08T12:31:07.000Z (almost 10 years ago)
- Last Synced: 2024-04-10T14:03:52.960Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 206 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## jQueryEachSelector [![Build Status](https://travis-ci.org/felquis/jQueryEachSelector.png?branch=master)](https://travis-ci.org/felquis/jQueryEachSelector)
Select multiple elements with complex selectors to do the same action in all.
## How to use
Pass a array of selectors to the plugin function, as below:```js
$.eachSelector([
$('#element').find('a.test'),
'#otherElement > a',
$('input[name="test"]').parents('p')
]).css({ color : 'yellow'});
```The plugin will concatenate the selectors and returns them.
## Another approach
To do the same thing without using this plugin, do as below:
```js
$('.element').find('> a.test').add(
$('#otherElement > a')
).add(
$('input[name="test"]').parents('p')
).css({
color : 'red'
});
```
This works perfectly, but it is hard to write and understand, don't you thing?## Browser support
This plugin works fine from jQuery 1.4 until the last version.## Build this project
Install [NodeJS](http://nodejs.org/download/), [GIT](http://git-scm.com/downloads) if you don't have it yet, [bower](http://bower.io/) and [grunt](http://gruntjs.com/)
```bash
npm install bower
npm install grunt-cli
```1 - Clone it:
`git clone [email protected]:felquis/jQueryEachSelector.git`2 - Then go to the project's folder:
`cd jQueryEachSelector`3 - Install dependencies:
`npm install`4 - Run:
`grunt build`Maybe you'll need to use the `sudo` prefix
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D## License
Use in everything you feel necessary.
And do not remove the link from this repository :)