Really? So then how would I assign the variable so it would work
anywhere when a certain element is clicked?

On Apr 15, 9:16 am, Josch <jluelsd...@googlemail.com> wrote:
> You initialize the variable within your function ("var color").
> This means the variable works only within the function.
> You have to initialize it outside your function (Before "$
> ("span.yellow").click()").
>
> Josch
>
> On 15 Apr., 15:26, Connor <con...@letsbeglobal.com> wrote:
>
> > 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.

Reply via email to