14
11

More than 5 years have passed since last update.

input/textareaでIMEでの変換中にchangeイベントを間引く

Last updated at Posted at 2015-04-12
node = document.querySelector('input#my-query')
_onComposition = false
node.addEventListener 'change', (ev) =>
  return if _onComposition # 変換中
  console.log ev.target.value

node.addEventListener 'compositionstart', =>
  _onComposition = true

node.addEventListener 'compositionend', =>
  _onComposition = false

CompositionEvent - Web API インターフェイス | MDN

14
11
1

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
14
11