32
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

IEでpreventDefaultを使うときにはまったこと

Last updated at Posted at 2014-06-19

IE7~11上で動かすWebシステム上でフォームの入力制限にevent.preventDefault()メソッドを使って形式外入力を受付けないようにしていたのですが、IE10以前?(IE8で確認)だとエラーに。。。
reutrn falseだとie11はスルーだと!?これだからIEは。。。

対処方法
(event.preventDefault) ? event.preventDefault():event.returnValue=false;
  • event.preventDefault()

指定したエレメントで発生するアクションを停止させるメソッド。

32
33
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
32
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?