]> git.ardis.lu - utf-8-visualizer/commitdiff
Focus input on "/" key press
authorArdis Lu <ardisglu@gmail.com>
Wed, 2 Apr 2025 04:36:38 +0000 (21:36 -0700)
committerArdis Lu <ardisglu@gmail.com>
Wed, 2 Apr 2025 04:36:38 +0000 (21:36 -0700)
script.js

index 53b6318d61d7d97dfc60343dc72e1cbdc576fca8..d8a88dba06b0d325cb1c3ca561219606aa16eede 100644 (file)
--- a/script.js
+++ b/script.js
@@ -98,3 +98,7 @@ const input = document.querySelector('input');
 input.addEventListener('input', e => handleChange(e.target.value));
 input.value = new URL(document.location).searchParams.get('q') ?? '🏴‍☠️';
 handleChange(input.value); // Render the default value on first load
+
+addEventListener('keyup', e => {
+  if (e.key === '/') { input.focus(); }
+});
This page took 0.031908 seconds and 4 git commands to generate.