Namespace: Strings:maskForSelector

Strings:maskForSelector

Source:

Methods

maskForSelector(str) → {String}

Masks all selector-special-characters, to allow selecting elements with special characters in selector using querySelector and querySelectorAll (also works for jQuery and Cash).

Parameters:
Name Type Description
str String

the string to mask for use in a selector

Source:
Returns:
the masked string
Type
String
Example
document.querySelector(`#element_${maskForSelector(elementName)}`).classList.remove('test');