helperclass

1.0.10 • Public • Published

helperclass

A simpler class manager of your html

  • Using only pure JavaScript

Installation

$ npm install helperclass

Example

<script src="helperclass.js">
	var element = document.getElementById("my-id");

	windows.helperclass.has(element, 'class-name');
	windows.helperclass.add(element, 'class-name');
	windows.helperclass.remove(element, 'class-name');
	windows.helperclass.toggle(element, 'class-name');
</script>

OR

import helperclass from 'helperclass'

var element = document.getElementById("my-id");

helperclass.has(element, 'class-name');
helperclass.add(element, 'class-name');
helperclass.remove(element, 'class-name');
helperclass.toggle(element, 'class-name');

element => params is the element to find, 'class-name' => params is will work

Props

Name Description
has Verify element has class (true or false)
add Add class to element
remove Remove class to element
toggle Add class to element if not exist ou remove if exist

Package Sidebar

Install

npm i helperclass

Weekly Downloads

1

Version

1.0.10

License

ISC

Last publish

Collaborators

  • brunosecco