[jQuery] Assigning variable on click
Hi,
One other quick question: I'm trying to assign a value to a variable
when a certain element is clicked. Here is my code (wrapped in the
normal jquery ready function)
$("span.yellow").click(function(){
var color = '#f8e226';
});
$(".color-changer span").click(function(){
$(".title b").animate( { color: color }, 1000);
$(".thick").animate( { backgroundColor: color }, 1000);
$("a.link").animate( { color: color }, 1000);
});
I am using the color plugin to allow me to animate color values. As
you can see, I'm referencing the variable color in the next function.
Am I missing something, because this doesn't work.