Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript keyup event enter key

// Get the input field
var input = document.getElementById("myInput");

// Execute a function when the user presses a key on the keyboard
input.addEventListener("keypress", function(event) {
  // If the user presses the "Enter" key on the keyboard
  if (event.key === "Enter") {
    // Cancel the default action, if needed
    event.preventDefault();
    // Trigger the button element with a click
    document.getElementById("myBtn").click();
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: Enable Cookies and JavaScript in Internet Explorer 9.0 
Javascript :: javascript extrsct object 
Javascript :: how to calculate time difference in js 
Javascript :: hover over class apply to subclass 
Javascript :: what does react js allows us to do 
Javascript :: invert binary tree js 
Javascript :: convert java object to json 
Javascript :: vscode react debug chrome profile 
Javascript :: .pop get second element of url 
Javascript :: telegram web app js 
Javascript :: get src vanilla js 
Javascript :: javascrpt 
Javascript :: easyui treegrid check if row exists 
Javascript :: why is table.current.row.length not working 
Javascript :: rendering component in route with properties 
Javascript :: CalendarApp.newRecurrence 
Javascript :: suffic prefix jsps 
Javascript :: grepper answer 
Javascript :: how concatenate arrays in es6 
Javascript :: axios get request with body 
Javascript :: javascript events reference 
Javascript :: how to get file tree of specific folder in node js 
Javascript :: for ... in ... 
Javascript :: get form control value in angular 8 
Javascript :: node js euro sign 
Javascript :: straforma in string js 
Javascript :: react-native-calendars how to mark selected day 
Javascript :: html onrightclick 
Javascript :: non-arrow functions are forbidden $(document).ready(function() { 
Javascript :: set-date-picker-range-with-in-a-financial-year-based-on-the-document 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =