Skip to content

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

License

Notifications You must be signed in to change notification settings

jaredwilli/qlass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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