What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-28 02:35:13
prevent default on enter press
/* Jquery method */ $('#form-input').on('keypress', (e) => { const keyPressed = e.keyCode || e.which; if (keyPressed === 13) { e.preventDefault(); return false; } /* or */ return keyPressed !== 13; }); /* or */ $('#form-input').on... Add solution -
Javascript 2021-10-20 23:01:08
add javascript keyup on input
<input type="text" class="form-control" placeholder="Search" id="search_id"/> <script type="text/javascript"> const log = document.getElementById('search_id'); document.addEventListener('keyup'... Add solution -
Javascript 2021-10-20 11:38:08
HTML5 Accesskey Attribute: you may not need JavaScript to add Keyboard Shortcuts
// Register the key handler document.addEventListener('keyup', function(e){ // This would be triggered by pressing CTRL + A if (e.ctrlKey && e.keyCode == 65) { window.location.href = "http://ourcodeworld.com"; } ... Add solution -
Javascript 2021-10-12 05:23:07
javascript trap focus
/** *Function should be called on keyPress or something */ function _focusTrapperEvent(e) { if (!(e.key === 'Tab' || e.keyCode === 9)) return; let condition = 'a[href], area[href], input:not([disabled]):not([type="hidden"]), select:not([... Add solution -
VBA 2021-10-02 01:48:03
move player with keyboard with boundaries vb.net
'Note: before I did the code, I added 2 labels, 4 timers '(names are "tmrRight", "tmrleft", "tmrUp", and "tmrDown") 'and 3 pictureboxes (one of which is named "pbPlayer") 'the 2 labels and 2 pictureboxe... Add solution