I have a list of friends, (BOB, TINA, LISA, TERRY, MIKE) and each listed person has a picture identifying them on hover. When you click on that person their image stays on the screen, until you click a different person. Currently I am getting the same persons picture on click regardless the name I select.
How to I create a dynamic click function in js? When I click on a listed friend, I would like the click function to recognize which person I selected and display the image associated with that person.
Can someone please help me?
CSS
.BOB,.TINA,.LISA,.TERRY,.MIKE { background: url("../theme/images/blank.png") no-repeat 0 0; }
.BOB:hover { background: url("../theme/images/BOB.png") no-repeat 0 0; }
.TINA:hover { background: url("../theme/images/TINA.png") no-repeat 0 0; }
.LISA:hover { background: url("../theme/images/LISA.png") no-repeat 0 0; }
.TERRY:hover { background: url("../theme/images/TERRY.png") no-repeat 0 0; }
.MIKE:hover { background: url("../theme/images/MIKE.png") no-repeat 0 0; }
.highlight { background: url("../theme/images/BOB.png") no-repeat 0 0; display: block;}
JAVASCRIPT
$(document).ready(function(){
$('a').click(function(){
$(".highlight").removeClass('highlight')
$(this).addClass('highlight');
});