Here's my code
for(var i = 0; i<tabs.length; i++)
        {
                alert(tabs[i].getAttribute('value'));
                tabs[i].onclick = function() {
                        alert("clicked");
                        alert(tab[i].getAttribute('value'));
                };
        }
This is all in the window.onload function. The first alert works, i.e. the value of each input element is alerted when the page loads. Then, when I click one of the buttons, "clicked" is alerted, but not the value attribute.
Say I have three tabs with the values "home", "about", and "contact". Is there a way to have access to (in this case, simply alert) the value (or any other) attribute when they're clicked without manually writing each onclick method?
Thanks
 
     
    