You need to put your code in the click handler for the item li.one. Try the following:
$(document).ready(function() {
$('li.one').click(function() {
if ($(this).hasClass('active')) {
$("#icon1").html('<img src="images/summary_icon_u.png" />');
} else {
$("#icon1").html('<img src="images/summary_icon_c.png" />');
}
});
});
Note that you can also shorten this code using a triple expression:
$(document).ready(function() {
$('li.one').click(function() {
$("#icon1").html('<img src="images/summary_icon_' + ($(this).hasClass('active') ? 'u' : 'c') + '.png" />');
});
});
, HTML JS, , DRY- , DOM li, a. :
$(document).ready(function() {
$('li').click(function() {
$(this).find('a').html('<img src="images/summary_icon_' + ($(this).hasClass('active') ? 'u' : 'c') + '.png" />');
});
});