Change text link colour / restore link colour

Hi -

I’m trying unsuccessfully to get some text links to change & restore their colour.

Referencing this link - there are 3 text links at the top of the page, which scroll to different anchor points on the same page.

I need the following to happen:

On hover, change colour (easy using css)
On click link A, change colour ***
When clicking link B, link A restores to original colour. ***

*** If someone can offer me a javascript solution - I would be VERY grateful.

Best

Andrew

You can continue using css with the active and focus pseudo-classes.

Do you want link A to stop being selected when the person clicks somewhere else? That situation is easy. When the link is clicked, trigger the focus event for the link, and return false to prevent the link from bring followed.

Do you want link A to always retain its setting until another link is clicked? Use javascript t remove a class name called selected from all appropriate links, and then apply that selected class name to the one that was clicked.

A very nice & simple solution. Thanks so much.

Hi Paul -

Thanks again for your quick response.

I can’t write javascript - so if you could kindly point me in the direction to:

Use javascript t remove a class name called selected from all appropriate links, and then apply that selected class name to the one that was clicked.

It would be a a huge help.

Best

Andrew

Oh dear, if you can’t write JavaScript then you may have to find someone who can write it for you.