Katastrophe: HTML Input (Autofocus) mit value. Focus an das ENDE des Input Feldes

Beitrag lesen

Hallo,

danke für den Hinweis, leider ebenfalls ohne Änderung:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" />

<script>
//usage
moveCursorToEnd($('input'));

function moveCursorToEnd(el) {
    if (typeof el.selectionStart == "number") {
        el.selectionStart = el.selectionEnd = el.value.length;
    } else if (typeof el.createTextRange != "undefined") {
        el.focus();
        var range = el.createTextRange();
        range.collapse(false);
        range.select();
    }
}
</script>
<input type="search" class="form-control form-control-lg" name="s" value="Katastrophe" id="search" />