Is there any way to change the attributes of an element when clicking on another element? For example, consider this approach where I have a link like so:
<a href="#100">Click me!</a>
And then close to it I have this:
<span id="100" class="clickTarget">Important text</span>
And then on my css file I have this:
.clickTarget:target {
color: #4f8dd5;
}
That means whenever the link is clicked, Important text
changes its color. The problem with this approach is that the page is also scrolled even if only a bit. Is there any other way to do this that doesn't scroll the page?
You can use jQuery if you see fit.