VOOZH about

URL: https://www.geeksforgeeks.org/javascript/vue-js-v-onkeyup-directive/

⇱ Vue.js v-on:keyup Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Vue.js v-on:keyup Directive

Last Updated : 15 Jul, 2025

The v-on:keyup directive is a Vue.js directive used to add an event listener to an button in the keyboard. First, we will create a div element with id as app and let's apply the v-on:keyup directive to the input element. Further, we can execute a function when we press the associated key.


Syntax:

v-on:keyup="function"
Supported Keys: Following keys are supported:
  • Enter key: .enter
  • Tab key: .tab
  • Delete key: .delete
  • Esc key: .esc
  • Up key: .up
  • Down key: .down
  • Left key: .left
  • Right key: .right


Parameters: This directive holds function as a value that will be executed when the key event occurs.
Example: This example uses VueJS to toggle the visibility of a element with v-on:keyup using Enter key.

Output:

👁 Image
Comment
Article Tags: