":visited" is a pseudo class, not an attribute, and cannot be directly
added to a link. In order to have control of how links look when they
are clicked or visited is to assign your own class. From what I
understand, you want to assign a class of "current" to any link that
is clicked. When another link is clicked, you want to assign it a
class of "current" but also remove the "current" class from all other
links. Is that right?

The code sample I provided does just that, or should do that, I didn't
actually test it. The "current" class should persist until another
link is clicked. Maybe I'm not fully understanding what you are trying
to do.

Let me know if I understand what you are trying to accomplish, then we
can go from there.

Brian

On May 14, 4:59 pm, wattaka <[EMAIL PROTECTED]> wrote:
> Thanks for the tip Brian, but I am looking for a method  that assigns
> the A tags ":visited" attribute so that the class remains active for
> the link till another link is clicked. The method you posted assigns
> the class only when clicked and does not persist
>
> On May 14, 10:18 pm, motob <[EMAIL PROTECTED]> wrote:
>
> > You'll need to add a click listener to each link, then when the user
> > clicks, add the class 'current'. When the user clicks another link you
> > can remove the "current" class from all links inside the div before
> > assigning the 'current' class back to the clicked link. You can do
> > something like this.
>
> > $(document).ready(function(){
> >   $('#right a').click(function(){
> >     $('#right a').removeClass("current"); //remove the current class
> > from any link inside the div
> >     $(this).addClass("current"); //add the current class to the link
> > that was clicked.
> >   });
>
> > });
>
> > Brian
>
> > On May 14, 3:24 pm, wattaka <[EMAIL PROTECTED]> wrote:
>
> > > I am trying to assign a tags in a DIV a class when they are clicked
> > > and and visited and remove the class when another tag in the DIV is
> > > clicked, I tried this t activate the tag:
>
> > > $('#right a').focus(function(){
> > >                         $(this).addClass('current')
>
> > >                         });
>
> > > This assigns all the a tags in the "right" div the clas 'current' but
> > > only when clicked on, can anyone give me a clue?
>
> > > Thanks

Reply via email to