I have a simple function to toggle list item class from \"active\" to \"inactive\". What is the most efficient way (i.e., using the least amount of code) to set all other list i
$('ul li').click(function() { $('ul li').each(function() { $(this).removeClass('active'); }); $(this).addClass('active'); });
JSFiddle