Getting elements title's with javascript
<p>I am trying to retrieve the title of elements with the following codes </p>

<pre><code>function highlight(elem) {
    var e = new Array();
    if (elem.style.border == '2px solid blue') {
        elem.style.border = '';
    } else elem.style.border = '2px solid blue';
    e.push(elem.title);
    var x = document.getElementById("test");
    x.innerHTML = e;
}
</code></pre>

<p>But it does not work. I have also tried passing 'this.title' in the function and displaying it, still does not work. Right now i am passing 'this' only.</p>

<p>Any idea?</p>
