I like to select every span, thats in "this" $(this "span")
sorry, simple and stupid... full function: function liCounting (){ $("#staerke1 li,#staerke2 li").each(function(liCounter){ liCounter++; //set liCounter to 1, not 0 $(this "span").replaceWith("<span>"+ liCounter +". </span>"); }) }; thx tom