htmx.addClass() (adds a class to the given element)

Description

This method adds a class to the given element. Parameters

  • elt - the element to add the class to

  • class - the class to add

Example:

// add the class 'myClass' to the element with the id 'demo'
htmx.addClass(htmx.find('#demo'), 'myClass');