Page:
EVENTS Keyboard
Pages
A-Z
CSS Classes & Styles
DATA Utilities (Arrays)
DATA Utilities (Objects)
DOM Attributes
DOM Content
DOM Manipulation
DOM States
DOM Traversal
EFFECTS Fade
EFFECTS Slide (horizontal)
EFFECTS Slide (vertical)
EVENTS Bindings
EVENTS Form
EVENTS Keyboard
EVENTS Lifecycle
EVENTS Mouse
EVENTS Touch
HTTP Requests
Home
Installation
Quick Start
The Frankenstein Chain
UTILITIES
No results
1
EVENTS Keyboard
Sven Minio edited this page 2026-05-17 19:59:05 +02:00
Table of Contents
keydown|keyup|keypress|pressedKey
.keydown
Description Bind an event handler to the "keydown" event, or trigger it.
Parameters
handler(Function, optional): Function to execute.
Returns
- (jBase): Current instance.
Example
$(document).keydown(function(e) {
console.log('Key pressed:', e.key);
});
.keyup
Description Bind an event handler to the "keyup" event, or trigger it.
Parameters
handler(Function, optional): Function to execute.
Returns
- (jBase): Current instance.
Example
$('#input').keyup(function() {
console.log('Key released');
});
.keypress
⚠️ DEPRECATED: This event is officially deprecated in modern web standards. Please use
.keydown()instead.
Description Bind an event handler to the "keypress" event, or trigger it.
Parameters
handler(Function, optional): Function to execute.
Returns
- (jBase): Current instance.
Example
$(document).keypress(function(e) {
// Logic here
});
.pressedkey
Description A specialized helper method. It attaches a listener that only executes the handler if a specific key matches.
Parameters
key(String): The key value to check for (e.g., 'Enter', 'Escape').handler(Function): Function to execute if the key matches.
Returns
- (jBase): Current instance.
Example
$('#search').pressedkey('Enter', function() {
console.log('Enter key was pressed, submitting search...');
});