Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joyqi/cash-selector
A small querySelector and querySelectorAll alternative.
https://github.com/joyqi/cash-selector
Last synced: 17 days ago
JSON representation
A small querySelector and querySelectorAll alternative.
- Host: GitHub
- URL: https://github.com/joyqi/cash-selector
- Owner: joyqi
- License: mit
- Created: 2022-11-09T10:09:15.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-10T03:55:44.000Z (about 2 years ago)
- Last Synced: 2024-08-02T20:37:42.470Z (3 months ago)
- Language: TypeScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cash-selector
Cash Selector is a simple querySelector and querySelectorAll wrapper.
It wraps the native querySelector and querySelectorAll methods to provide a more convenient way to select elements.## Installation
```bash
npm install cash-selector
```## Usage
```typescript
import { $, $$ } from 'cash-selector';const element = $('#my-element');
const elements = $$('.my-elements');
```You can also specify a generic type to get the correct type of the element.
```typescript
import { $, $$ } from 'cash-selector';const element = $('#my-element');
const elements = $$('.my-elements');
```Parent element can be specified as the second argument.
```typescript
import { $, $$ } from 'cash-selector';const element = $('#my-element', '#parent-element');
const elements = $$('.my-elements', '#parent-element');
```