A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/ja/docs/Web/API/HTMLTextAreaElement/selectionStart below:

HTMLTextAreaElement: selectionStart プãƒãƒ‘ティ - Web API

HTMLTextAreaElement: selectionStart プロパティ

Baseline Widely available

selectionStart は HTMLTextAreaElement インターフェイスのプロパティで、 <textarea> 要素内における現在のテキスト選択範囲の先頭の位置を指定します。これは、選択されたテキストの最初のインデックスを表す数値です。 <textarea> の選択されたテキストの最初のインデックスを取得したり、設定したりする際に使用することができます。

何も選択されていない場合、 selectionStart および selectionEnd の値は、どちらも <textarea> 要素内のカーソル(キャレット)の位置になります。

selectionStart を現在の selectionEnd の値より大きな値に設定すると、selectionStart と selectionEnd の両方のプロパティがその値に更新されます。 どちらの値も textLength 以上の場合、両方のプロパティが textLength プロパティの値に設定されます。

このプロパティ値は、この <textarea> にフォーカスがなくても取得したり設定したりすることができますが、要素にフォーカスがないと、 ::selection 擬似要素が選択テキストと一致しません。

selectionStart を新しい値に設定すると、 selectchange および select イベントが発生します。

値

非負の数値です。

例
const textarea = document.getElementById("text-box");
const start = textarea.selectionStart;
仕様書 ブラウザーの互換性 関連情報

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4