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 |
Returns:
true if value is an HTML element
- Type
- Boolean
Example
if( isElement(target) ){
target.classList.add('foo');
}