A RetroSearch Logo

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

Search Query:

Showing content from https://webplatform.github.io/docs/dom/HTMLInputElement/selectionEnd below:

selectionEnd · WebPlatform Docs

selectionEnd

Property of dom/HTMLInputElementdom/HTMLInputElement

Syntax
var result = element.selectionEnd;
element.selectionEnd = value;
Examples

The following code example shows how to set a text selection’s start and end positions.

<!DOCTYPE html>
<html>
<head>
<title>Selection Start and End example</title>
    <script>
        function SelectSomeText () {
            var input = document.getElementById ("Textbox");
                input.selectionStart = 4;
                input.selectionEnd = 13;
        }
    </script>
</head>
<body>
    <p><input type="text" id="Textbox" size="40" value="The text selection appears here"/></p>
    <p><button onclick="SelectSomeText ()">See selection</button></p>

</body>
</html>
Notes Remarks

If you do not select text, selectionEnd returns the offset of the character that immediately follows the text cursor or caret.

Syntax Standards information See also Related pages Attributions

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