jQuery Simulate Keypress Trigger


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //this works
  2. e = jQuery.Event("keyup");
  3. e.which = 13 //enter key
  4. jQuery('input').trigger(e);
  5.  
  6. //this doesn't
  7. e = jQuery.Event("keypress");
  8. e.which = 13 //enter key
  9. jQuery('input').trigger(e);

Report this snippet


Comments


You need to login to view comments.