programming-examples/js/Object/Check whether a specified value is a DOM element .js

4 lines
134 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function is_dom_element(obj) {
return !!(obj && obj.nodeType === 1);
}
console.log(is_dom_element(jQuery('body')[0]));