I want to allow the use to slide up and down when pressing up arrow and down arrow, I mean if “roma” is highlighted and I pressed down then “milan” should be highlighted. Here is my HTML:
<li id="place">
<p>roma</p>
<p>milan</p>
<p>napoli</p>
</li>
I want to do this using Javascript, perhaps using onclick().
which javascript attribute should i used and how to hightlight something using css
thank you
You can append a CSS class to highlight the respective element upon clicking it. Using jQuery toggle will allow you to toggle the highlighting of an element. jsFiddle example coming soon…
jQuery Example:
http://jsfiddle.net/2NS5V/2/
JavaScript Example:
http://jsfiddle.net/GDEeW/1/