I am trying to get keyup event on a specific element in svelte but it seems it is not possible. I checked this REPL and also I tried by adding the event to the document and it worked fine. But I don't want to add it to the document and I just want to have it on my element.
<script> const key = () => { console.log('key') } </script> <div on:keyup={key}></div> 5Related questions 3 Add event directive to svelte html expression? 12 How to bind events dynamically in Svelte? 6 Add onChange handler to input in svelte Related questions 3 Add event directive to svelte html expression? 12 How to bind events dynamically in Svelte? 6 Add onChange handler to input in svelte 2 How do I add keyboard navigation to a svelte app (other than window object)? 2 How do I create a custom event in Svelte? 8 svelte: how to use event modifiers in my own components 11 on:keydown event with Enter Key in svelte 0 Pass event options to on:event directive 0 Can you set element events programmatically in Svelte? 0 How to listen to a svelte event in a HTML page? Load 7 more related questions Show fewer related questions
Reset to default