Skip to content

jaredwilli/qlass

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Qlass.js

=====

A library for performing common classy functions on elements and collections.

Usage

<div id="main" class="content js"></div>

q(document.getElementsByTagName('div')).addClass('new-class');

var main = document.getElementById('main');

if (q(main).hasClass('js')) {
	q(main)
		.addClass('css')
		.removeClass('content');
}

Use q() as the wrapper and pass it any Element or HTMLCollection of elements that you want to add, remove or check if they have a class.

q(elem).addClass('string')
q(nodes).hasClass('string')
q(el).removeClass('string')

If there is no element or nodelist selected it will return this back after checking for a null element or nodelist length of 0.

About

Micro library for addClass() hasClass() removeClass() with Elements and NodeLists

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published