Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well, first of all I want to tell you that <code>Object.prototype.toString</code> returns the value of the object's internal <code>[[Class]]</code> property, it isn't really a <em>Type</em>.</p> <p>The value of this internal property represents the <em>specification defined classification</em> of an object (more info <a href="https://stackoverflow.com/questions/3250379/what-is-the-call-function-doing-in-this-javascript-statement/3250415#3250415">here</a>).</p> <p>Javascript has only 6 <em>language types</em>: <em>Object, String, Number, Boolean, Null and Undefined</em>, that's it.</p> <p>The value of the <code>[[Class]]</code> internal property for host objects -as DOM elements- can be <strong>anything</strong>, it is completely <em>implementation-dependent</em>, on built-in objects is safe to use it -except with some exceptions in IE as @Alex pointed out in the article linked in his answer-.</p> <p>You are working with DOM elements, and you want to figure out what kind of node it is, my suggestion to this, is to simply use the <code>nodeName</code> property <sub>(please avoid using <code>tagName</code>)</sub>.</p> <p>The <code>nodeName</code> property contains the name of the node you are dealing it, in upper case, therefore you could use it as this:</p> <pre><code>function getFilteredElements() { var tabContent = getElementsByClass("tabContentWrap", document.getElementById(tabWrapId), "div"); for (var j = 0; j &lt; tabContent.length; j++){ tabContentLinks = tabContent[j].getElementsByTagName('*'); for (var k = 0; k &lt; tabContentLinks.length; k++){ // Here i attempt to filter the collection if (tabContentLinks[k].nodeName == 'SELECT') { // &lt;- SELECT elements alert("found select list"); } } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload