Namespace: Basic:isElement

Basic:isElement

Source:

Methods

isElement(value) → {Boolean}

Returns if a value is an HTML element. Be aware, that this explicitly means an element, not necessarily any node. So text nodes, comments and such do not qualify. Also keep in mind, that SVGs are also something different.

Parameters:
Name Type Description
value *

the value to check

Source:
Returns:
true if value is an HTML element
Type
Boolean
Example
if( isElement(target) ){
  target.classList.add('foo');
}