HTMLTextAreaElement: selectionStart ããããã£
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015å¹´7æ.
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;
仿§æ¸
| Specification |
|---|
| HTML> # dom-textarea/input-selectionstart> |
ãã©ã¦ã¶ã¼ã®äºææ§
é¢é£æ å ±
<textarea>HTMLTextAreaElementHTMLTextAreaElement.selectionEndHTMLTextAreaElement.selectionDirectionHTMLTextAreaElement.textLengthHTMLTextAreaElement.select()HTMLTextAreaElement.setSelectionRange()HTMLTextAreaElement.setRangeText()HTMLInputElement.selectionStartSelection::selectionæ¬ä¼¼è¦ç´