Try with the keyup event:
$(document).on('keyup', function(e) {
if (e.key == "Enter") $('.save').click();
if (e.key == "Escape") $('.cancel').click();
});
More Related Contents:
- Get one element title and add this to another div in jquery
- Adding The Anchor Text As The Title Dynamicaly
- Get all Attributes from a HTML element with Javascript/jQuery
- JavaScript before leaving the page
- How to use jQuery in Firefox Extension
- JSF/PrimeFaces ajax updates breaks jQuery event listener function bindings
- How can I use jQuery to style /parts/ of all instances of a specific word?
- Get unique selector of element in Jquery
- One time page refresh after first page load
- How to get client IP address using jQuery
- Is there any cross-browser javascript for making vh and vw units work
- Retrieving file names out of a multi-file upload control with javascript
- How to disable Chrome’s saved password prompt setting through JavaScript
- How to find if div with specific id exists in jQuery?
- Only on Firefox “Loading failed for the with source”
- Check if parent window is iframe or not
- values not updated after an ajax response
- Remove all attributes
- Clone a file input element in Javascript
- jQuery vs. javascript? [closed]
- submit event does not fire if submit initiated programmatically
- jQuery plugin DataTables: How to highlight the current search text?
- jQuery append() vs appendChild()
- Add CSS rule via jQuery for future created elements
- jQuery continuous mousedown
- closure inside a for loop – callback with loop variable as parameter [duplicate]
- jQuery addClass onClick
- Is My Page Being Loaded from the Browser Cache?
- In jQuery, is there any way to only bind a click once?
- Renaming object keys recursively