Methods
isSelector(value) → {Boolean}
Returns if a value is a valid selector, usable in methods such as querySelector and querySelectorAll.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | the value to check |
Returns:
true if value is a valid selector
- Type
- Boolean
Example
if( isSelector(selector) ){
document.querySelector(selector)?.style.setProperty('color', 'red');
}