Check if INSERT mode is ON when typing in an input

前端 未结 2 1283
名媛妹妹
名媛妹妹 2021-01-19 05:35

I\'m trying to calculate the value of an input field on various events regardless of the event caught.

I\'m taking into account the events keypress keyup keydow

2条回答
  •  萌比男神i
    2021-01-19 05:42

    For IE only:

    document.queryCommandValue("OverWrite");
    

    As far as I know, Firefox and Chrome don't have overwrite mode. The insert key doesn't work in those browsers, and they are always in insert mode.

    Moreover, Mac keyboard doesn't have a insert key from the beginning. So Safari also is always in insert mode.

提交回复
热议问题