Hinweis: Dieses Beispiel funktioniert NICHT wenn eine Konsole (WebIDE, Entwicklungswerkzeuge) offen ist:
<html>
<input type="search" class="form-control form-control-lg" name="s" value="Katastrophe" id="search" />
<script>
function moveCursorToEnd( el ) {
el.focus();
if ( typeof( el.selectionStart ) == "number" ) {
el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
var range = el.createTextRange();
range.collapse( false );
range.select();
}
}
var el = document.getElementById( "search" );
moveCursorToEnd( el );
</script>
</html>