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/selectionEnd below:

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

HTMLTextAreaElement: selectionEnd プロパティ

Baseline Widely available

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

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

selectionEnd を現在の selectionStart の値より小さい値に設定すると、selectionEnd と selectionStart の両方のプロパティがその値に更新されます。 どちらの値も 0 未満の場合、両方のプロパティが textLength プロパティの値に設定されます。

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

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

値

非負の数値です。

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

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