document.querySelectorAll('#search_resultsRows a').forEach(function(aTag, index) { aTag.textContent = (index + 1) + '. ' + aTag.textContent; });