javascript class finding elements based on a keyword in id, class, href or name
<p>I made a class so that I can find specific elements based on a keyword in the elements id, class, name, or href. If a match is found it then gets pushed to an array. I managed to get this working on its own, but when I made it into a class it does not push any elements to the array. It seems to work to a degree because it finds all the <code>a</code> elements but it just doesnt match on keywords. What seems to be wrong here?</p>

<p><strong>HTML</strong></p>

<pre><code>&lt;a href="linka.html" id="poll-answer-8234" class="ca" name="poll_430" value="8234"&gt;
&lt;a href="linka.html" id="poll-answer-9234" class="ca" name="poll_430" value="9234"&gt;  
&lt;a href="linkb.html" id="survey-answer-7866" class="cb" name="poll_430" value="7866"&gt;
&lt;a href="linkb.html" id="survey-answer-8998" class="cb" name="poll_430" value="8998"&gt;
&lt;a href="linkc.html" id="quiz-answer-7866" class="cc" name="poll_430" value="7866"&gt;
&lt;a href="linkc.html" id="quiz-answer-8998" class="cc" name="poll_430" value="8998"&gt;
</code></pre>

<p><strong>JS</strong></p>

<pre><code>function nodeBulder(parameters) {
    this.selecter = parameters.selecter;
    this.targets = [];
    this.nodes = document.getElementsByTagName(parameters.tag);
    this.keyword = parameters.keyword;
    this.build = function () {
        switch (this.selecter) {
            case "byid":
                var count, node;
                for (count = 0; count &lt; this.nodes.length; count++) {
                    node = this.nodes[count].id.indexOf(this.keyword);
          console.log(node);
                    if (node === 0) {
                        this.targets.push(this.nodes[count]);
                    }
                }
                break;
            case "byname":
                var count, node;
                for (count = 0; count &lt; this.nodes.length; count++) {
                    node = this.nodes[count].name.indexOf(this.keyword);
                    if (node === 0) {
                        this.targets.push(this.nodes[count]);
                    }
                }
                break;
            case "byclass":
                var count, node;
                for (count = 0; count &lt; this.nodes.length; count++) {
                    node = this.nodes[count].className.indexOf(this.keyword);
                    if (node === 0) {
                        this.targets.push(this.nodes[count]);
                    }
                }
                break;
            case "byhref":
                var count, node;
                for (count = 0; count &lt; this.nodes.length; count++) {
                    node = this.nodes[count].href.indexOf(this.keyword);
                    if (node === 0) {
                        this.targets.push(this.nodes[count]);
                    }
                }
                break;
        }
    }
    this.random = function () {
        return this.targets[Math.floor(Math.random() * this.targets.length)];
    }
}

var idTest = new nodeBulder({ selecter: "byid", tag: 'a', keyword: 'poll-answer' });
var classTest = new nodeBulder({ selecter: "byclass", tag: 'a', keyword: 'cc' });

console.log(idTest.targets);
console.log(classTest.targets);
</code></pre>
