Hook JS event before and after chars typed