Tag JavaScript while loop