Yaj.js - Yet Another jQuery Replacement
Basic usage
The Yaj library like jQuery and Zepto exposes the "yo" instead "$".
"yo" requires a selector and all methods are based on the element (or elements) returned.
yo('selector').addClass('my-class');
The selector can be all valid HTML5 selector:
- Element Id (#name)
- Class (.name)
- Sequences ("#name #name2" OR ".name .name2" OR ".name #name2" and other combination)
- More than one on the same object (".name.name2")
- HTML Elements ("p", "div", etc)
- HTML Document (document)
- Window (window)
- HTML string (eg. "'text'")
- List of selectors (eg. "p, span, .class")
You can call more than one method in sequence:
yo('selector').removeClass('oneclass').addClass('otherclass');
Lightweight
Yaj is also lightweigth. Yaj have less than 18kb uncompressed, 8kb minified and 3kb minified and gzipped.
Installation
Yarn or NPM
yarn add yaj
or
npm i yaj
and then:
<script src="node_modules/yaj/yaj.min.js" />
CDN JSDELIVR
Latest version
<script src="https://cdn.jsdelivr.net/npm/yaj@1/yaj.min.js" />
Specific version
<script src="https://cdn.jsdelivr.net/npm/[email protected]/yaj.min.js" />