Namespace: Basic:isSelector

Basic:isSelector

Source:

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

Source:
Returns:
true if value is a valid selector
Type
Boolean
Example
if( isSelector(selector) ){
  document.querySelector(selector)?.style.setProperty('color', 'red');
}