Toggle State Of DOM Element – easy-toggle-state

Category: Javascript , Recommended | January 25, 2019
Author: Twikito
Views Total: 917
Official Page: Go to website
Last Update: January 25, 2019
License: MIT


Toggle State Of DOM Element – easy-toggle-state


easy-toggle-state is a pure JavaScript library to toggle the state of any elements using UI components such as Checkbox, Radio button, Tooltip, Accordion, Tabs, Lightbox, etc.

The main goal of this library is to toggle the CSS class of an element when the element or another element is clicked.

Basic usage:

Install the library with NPM:

$ npm install easy-toggle-state --save

Or download the zip and then include the main JavaScript file on the webpage.

<script src="easy-toggle-state.es6.min.js"></script>

Specify the active class when an element is clicked. The default active class is is-active.

<element data-toggle-class="active-class">

Also apply the active class to another element:

<element data-toggle-class="active-class"

Apply the active class to all child elements in a parent element.

<element data-toggle-class="active-class"

Apply the active class to all sub-elements in itself.

<element data-toggle-class="active-class"

Apply the active class to previous/next elements.

<element data-toggle-class="active-class"

<element data-toggle-class="active-class"


v1.101.0 (01/25/2019)

  • Fixed: window.initEasyToggleState(); does not work as expected

v1.9.5 (12/20/2018)

  • update

v1.9.4 (11/17/2018)

  • Doc and dependencies update

v1.9.3 (10/12/2018)

  • Fixed Warning in console log if no data-toggle-class is found

v1.9.2 (10/12/2018)

  • update

v1.9.1 (09/10/2018)

  • update

v1.8.2 (09/07/2018)

  • update

v1.8.0 (08/19/2018)

  • update

v1.7.0 (07/04/2018)

  • Sizes update

v1.6.5 (07/04/2018)

  • update

v1.6.4 (06/30/2018)

  • No more IE polyfills

v1.6.1 (06/28/2018)

  • Escape key management fix

v1.6.1 (06/27/2018)

  • bugfix

v1.6.0 (06/20/2018)

  • bugfix

v1.5.5 (06/14/2018)

  • bugfix

v1.5.3 (06/06/2018)

  • Update

v1.5.0 (06/01/2018)

  • Code optimizations

v1.4.2 (05/31/2018)

  • IE11 version now working

v1.4.2 (05/24/2018)

  • Better aria management

You Might Be Interested In:

Leave a Reply