I am using jQuery and populating an array on document.ready.
In my page I have some elements with a click event. I defined that function outside of the document.ready function.
I can't seem to figure out how to access that array variable from within my onclick function.
To simplify, I would like something like this to work:
$(document).ready(function(){
var artists = new Array();
artists.push('item1');
artists.push('item2');
});
function clickLink() {
alert(artists[0]);
}
vardoes. Why does this preventartistsfrom being accessed (much less, existing) in the other function?