I want to preload rollover images in jQuery but the list of images is inside list of like this:
<li><a href="/images/1.jpg"></a></li>
<li><a href="/images/2.jpg"></a></li>
<li><a href="/images/3.jpg"></a></li>
==========
function preload(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
});
}
var imagelist = $('li a').attr("href");
preload(imagelist);
I changed the last line so it just grab the href from my list. Original script was from: Preloading images with jQuery
Is this correct?