LoginSignup
0
0

More than 5 years have passed since last update.

textareaの特定部分を選択状態にする

Last updated at Posted at 2018-11-22

B(ボールド)ボタン押下時、テキストエリアの特定文字列を選択状態にする。

最初、フォーカスでいろいろ検索したが、
選択アクションであることに気づいた。
そこから、input element のsetSelectionRangeメソッドを発見。

setSelectionRangeの前にfocusが必要みたい。(何故なのか?)
https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange

0
0
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
0
0