i have no knowledge in javascript and the knowledge i have in css is not enough to figure it out, if it can be done ..
i have a div with five a’s in it:
<div>
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a>
<a>5</a>
</div>
How can i write something in javascript that would do something like:
on a:hover change the color of the a’s from the right of the a hovered
for example if all a’s are black and if i hover a2 … then turn a3, a4 and a5 to white, while a1 and a2 remain black
thanks for any links or feedback
A plain JavaScript method — doesn’t utilize jQuery.
Update:
Here is a demonstration.
Here’s a function that iterates over the
<a>inside<div>looking for the one clicked. All subsequent links are colored white.Note: Inline
onmouseoverattributes aren’t the best way of binding these events, but are certainly the easiest to get started.