View Full Version : "random" link colors?

10-11-2009, 04:00 AM
I have a div with a bunch of links. I'd like to specify a list of colors and then have the link list be randomly assigned the colors from the list. Can anyone help me with this? I've found scripts which will color all the links in the same random color upon reload, but I'd like all the links to be different colors. I hope this makes sense. :o

10-14-2009, 11:24 PM
Use the jquery selector to select all anchor tags, then change the CSS for each element, randomly assigning color.

Something like..

$(function() {
$("a").each(function (i) {

function getRandomColor() {
//return a random color value