I have a div with a bunch of list items in it. I just want to remove all the contents inside except for the last list item. Is it possible to use $(this) in reference to a div id without putting it inside some sort of click function? Something like this? (I know its wrong)
$('div[id='+id+']').html($(this).(".list-item:last"));
If not, would I need to make a function and then call it?
$('div[id='+id+']').function(){
$(this).html($(".list-item:last"));
}