Last active
January 12, 2021 20:07
-
-
Save henriksommerfeld/9610341affe9885aa839c2a1480077dd to your computer and use it in GitHub Desktop.
Shortcut for putting focus on searchbox using cjs extension for chromium browsers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('keydown', function (event) { | |
if (event.ctrlKey && event.key === 'f') { | |
const box = document.getElementById('search_form_input'); | |
box.focus(); | |
box.value = ''; | |
window.scroll(0,0); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('keydown', function (event) { | |
if (event.ctrlKey && event.key === 'f') { | |
const box = document.getElementById('q'); | |
box.focus(); | |
box.value = ''; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment