javascript - jquery (or pure js) simulate enter key pressed for testing -


What is the best way to emulate a user by pressing "enter"? $ (Element) .keypress () I do not have permission to pass in the actual key that was pressed.

This unit is for testing

 < Code> var e = jQuery.Event ("keypress"); E.which = 13; // Choose one that you ekcode = 13; $ ("#TheInputToTest") trigger (E).  

Comments