Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript detect enter press on input

var el = document.getElementById("myInputID");
el.addEventListener("keydown", function(event) {
    if (event.key === "Enter") {
        // Enter key was hit
    }
});
Comment

how to check if enter is pressed javascript

$('#usersearch').keydown(function(e){
    if(e.keyCode === 13){
            alert("Enter was pressed ");
     }  
});
Comment

javascript key pressed enter

$('.container').on('keydown', 'input', function(e) {
  if (e.keyCode === 13) {
    e.preventDefault();
  	e.stopImmediatePropagation();
    //Do your stuff...
  }
});
Comment

Javascript form check to see if return or enter was pressed

function handleKey(ev) {
            console.log(ev.type.toUpperCase(), ev.target.id, ev.target.value);
            let code = ev.keyCode || ev.which;
            if (code == 10 || code == 13) {
                //return or enter key
                handleSend(ev);
            }
        }
Comment

PREVIOUS NEXT
Code Example
Javascript :: split string by uppercase javascript 
Javascript :: how to insalk react router with npm 
Javascript :: uppercase angular pipe 
Javascript :: show and hide div tag based on checkbox selection using jquery 
Javascript :: country code regex 
Javascript :: how to connect frontend with solidity 
Javascript :: selected option attribute jquery 
Javascript :: react font awesome delete icon 
Javascript :: last field prisma 
Javascript :: how to remove last char from string in javascript 
Javascript :: wait until foreach is done javascript 
Javascript :: javascript clear style inline property 
Javascript :: separate digits in javascript 
Javascript :: javascript change webpage title 
Javascript :: javascript get current date jalali 
Javascript :: jquery scroll to top of div 
Javascript :: js get home url 
Javascript :: if document is loaded 
Javascript :: codeigniter raw query 
Javascript :: install react with old version of node 
Javascript :: gitignore for angular 
Javascript :: react get url querystring 
Javascript :: random code js 
Javascript :: loop on objects js 
Javascript :: random generating api for quotes 
Javascript :: mongodb delete user 
Javascript :: javascript add new array element to start of array 
Javascript :: insertion sort javascript 
Javascript :: reactjs checkbox 
Javascript :: if radio checked jquery 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =