Reader small image

You're reading from  JavaScript from Frontend to Backend

Product typeBook
Published inJul 2022
Reading LevelBeginner
PublisherPackt
ISBN-139781801070317
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Eric Sarrion
Eric Sarrion
author image
Eric Sarrion

Eric Sarrion is a trainer and a developer as an independent consultant. He has been involved in all kinds of IT projects for over 30 years. He is also a long time author in web development technologies and is renowned for the clarity of his explanations and examples.
Read more about Eric Sarrion

Right arrow

Using the $event parameter

Vue.js provides access to the Event object associated with the event. This object can then be used to get additional information about the event. The information is different depending on the type of event:

  • Mouse coordinates or buttons clicked on the mouse for a mouse-related event
  • Keyboard key used, or the combination of keys pressed (Ctrl, Shift, Esc, and so on) for a keyboard-related event

The Event object can be accessed from the $event variable. It can be passed as a parameter to a processing method. This parameter will then be retrieved in the event processing function.

Let’s see two examples of how to use this parameter when entering characters in an edit control:

  • By displaying an error message as soon as the numerical value entered equals or exceeds the value 100
  • By prohibiting the entry of characters other than numeric characters if the edit control can only contain numbers (this is an improvement of the previous...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
JavaScript from Frontend to Backend
Published in: Jul 2022Publisher: PacktISBN-13: 9781801070317

Author (1)

author image
Eric Sarrion

Eric Sarrion is a trainer and a developer as an independent consultant. He has been involved in all kinds of IT projects for over 30 years. He is also a long time author in web development technologies and is renowned for the clarity of his explanations and examples.
Read more about Eric Sarrion