I am trying to use JQuery next() to add CSS to one image at a time highlighting it. When the user clicks a button it should highlight the next() image with a border. Instead though it is highlighting all of the images after it.
$('#imageList img').next().addClass('selected');
It adds the class to ALL the images though.
this will get you what you want too http://jsfiddle.net/GWtg8/2/
$(document).ready(function(){
$('#btn').click(function(){
$('#cont img').not('.selected').first().addClass('selected');
}); });