Replace onkeyup hack with addEventListener