what RamboNo5 said, but if you want to edit the background color only for the first element, you can use
var origColor = $("ul.relatedAlbums li a:first").css("background-color", "red");
as you said, but I think you can also use
var origiColor = $("ul.relatedAlbums li").first().css("background-color", "red");
I have not tried it, but I think it should work, and I believe it is faster since you do not require parsing the selector.
take a look at: - api.jquery.com/first-selector/ - http://api.jquery.com/first/ for more information
user375700
source share