LoginSignup
3
2

More than 5 years have passed since last update.

リアルタイムにテキストボックスの入力値を取得する

Last updated at Posted at 2018-06-21

おなじみのchangeだと、フォーカス失ったときにしか発火しないのでこれまで工夫が必要でした。
知らなかったのですが、inputイベントてのがあり、これだとリアルタイムで入力を取得できます。

See the Pen Check Input Number (onInput) by pokkur (@pokkur) on CodePen.

ちなみに初期値は、dispatchEventでinputさせています。

origin.dispatchEvent(new Event('input'))
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2