On Fri, Mar 20, 2009 at 9:48 AM, Thierry <lamthie...@gmail.com> wrote:

>
> I have a bunch of hyperlinks with class 'hello_world'.  I want to
> assign each one of them a random colour.  I can set the colour for all
> of them with the following:
>
> $("a[class=hello_world]").css("color", "red");
>
> How can I iterate over every element with class name 'hello_world'?


$(function() {
$('a[class=hello_world]').each(function() {
 randomColor = (some code here to create a random color);
 $(this).css('color', randomColor);
});
});


-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.

Reply via email to