Make the first li the last regardless of how many li jQuery("#list li:last").after(jQuery("#list li:first"));