Skip to content

Instantly share code, notes, and snippets.

@7cc
Created August 8, 2014 20:39
Show Gist options
  • Select an option

  • Save 7cc/7d2573dec47a97a1d734 to your computer and use it in GitHub Desktop.

Select an option

Save 7cc/7d2573dec47a97a1d734 to your computer and use it in GitHub Desktop.
selectstart

文字選択を検知する

文字列選択で起きるイベント

on/selectstart:
  MSIEイベント
  Webkit系も対応
on/select:
  input, textareaのみで使用可
selectionStart:
  input, textareaのみ。キャレット位置を返す<i>プロパティ</i>

文字列選択方法とイベント

ユーザー操作 JS Event
double click dblclick
click -> shift + arrow-key keyup
drag mousedown + mousemove, mouseup
script (this.select()) -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment