Using Javascript to detect keypress event in text editor

Using Javascript to detect keypress event in text editor