Fixed bug with e.target being an input field