get type of element javascript code example
Example 1: how to know type of dom element in js
let divElement = document.createElement('div');
if (divElement.nodeName == "DIV") //true
if (divElement.nodeName == "<div>") //false
Example 2: js get element type
// Use the DOM element's 'tagName' property:
var element_type = field.tagName;