What is the jQuery Event for user pressing enter in a textbox?

jQueryWeb DevelopmentFront End Technology

The jQuery event for user pressing enter is keyup and keyCode. You can try to run the following code to trigger an event on pressing enter key in textbox,


Live Demo

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
     alert("Enter key pressed");
     if(e.keyCode == 13)
<input type="text">  
<p>Press Enter key in the above input text.</p>

Published on 20-Dec-2017 13:30:28