Add pure javascript code for listening key event