This should work. After .find('#rightshape')
, the selection is referring to the div
, and not the li
. .end
returns you to the previous selection.
jQuery(document).ready(function() {
$('#servicesleft').delegate('li', 'click', function() {
$(this).find('#rightshape')
.addClass('rightshapeactive')
.end()
.siblings()
.find('#rightshape')
.removeClass('rightshapeactive');
});
});
This might be even better:
jQuery(document).ready(function() {
$('#servicesleft').delegate('li', 'click', function() {
$('.rightshapeactive').removeClass('rightshapeactive');
$('#rightshape', this).addClass('rightshapeactive');
});
});