2

On a text input, I am trying to reverse up and down keypresses (because <input type="month"> feels upside down to me).

 <input type="month" @keyup.38.prevent="" @keyup.40.prevent=""/>

How can I simulate keypress and swap 38 and 40 (preferably inline) ?

(I know it's possible with jQuery but I wonder if it's possible solely with Vue)

senty
  • 12,385
  • 28
  • 130
  • 260
  • I will argue that it's not possible because when you dispatch an event you've created yourself it will not set the isTrusted flag and will be ignored by dom elements. Here's an older question of me for reference: https://stackoverflow.com/questions/45412590/sending-keyboard-events-programmatically-doesnt-dispatch-them-into-inputs . Maybe I understood the question incorrectly though. – Philip Feldmann May 20 '18 at 06:55
  • How about utilising jQuery? Is there any way anyone can think of? – senty May 20 '18 at 19:56
  • Why would you use a feature that only works with Chrome,Edge and Opera? – jacky May 22 '18 at 03:01
  • @jacky It's a private/closed system for internal use only, which will be used surely on those. I am aware of that limitation but thanks for the heads up. What would you use instead? :) – senty May 22 '18 at 20:25

0 Answers0