Remove all classes from an HTMLElement that contain a particular string.
Parameters:
Name | Type | Description |
---|---|---|
el | HTMLElement | The element to remove classes from. |
string | string | The string to remove any classes that contain it from the passed el. |
- Since
- 1.0.0
Returns:
- Type:
- void
Example
import { getNodes, openNewTab } from "@gravityforms/utils";
function Example() {
const node = getNodes( 'example' )[ 0 ];
node.classList.add( 'gform-block' );
node.classList.add( 'gform-block--red' );
node.classList.add( 'block' );
node.classList.add( 'width-auto' );
removeClassThatContains( node, 'gform' );
console.log( node.classList );
}