Skip to content

joyqi/cash-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

npm install cash-selector

Usage

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.

import { $, $$ } from 'cash-selector';

const element = $<HTMLDivElement>('#my-element');
const elements = $$<HTMLDivElement>('.my-elements');

Parent element can be specified as the second argument.

import { $, $$ } from 'cash-selector';

const element = $('#my-element', '#parent-element');
const elements = $$('.my-elements', '#parent-element');

About

A small querySelector and querySelectorAll alternative.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors