@hisho/query-selector
v0.9.4
Published
A simple DOM library
Downloads
9
Readme
querySelector
Features
- typescript
- vanilla js
Contents
Install
$ npm i @hisho/query-selector
Usage
querySelector() - string | NodeListOf<Element> | HTMLElement | HTMLElement[] | null
import {querySelector} from "@hisho/query-selector";
const dom = querySelector('div');
if(dom.exists) {
dom.all.forEach((item) => {
console.log(item);
});
}
API
all
return - HTMLElement[]
querySelector('div').all; //[div,div,...] or []
exists
return - boolean
querySelector('div').exists; //true or false