HTML Input (Autofocus) mit value. Focus an das ENDE des Input Feldes
bearbeitet von ursus contionabundo> Hallo, 
> 
> danke für den Hinweis, leider ebenfalls ohne Änderung: 
> 
> ~~~HTML
> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" />
> ~~~
wird nicht mehr gebraucht. Ist "Vanilla-JS"
> ~~~js
> //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(); wird außerhalb erledigt
>         var range = el.createTextRange();
>         range.collapse(false);
>         range.select();
>     }
> }
> ~~~
Dein DOM-Element hat die ID "search":
> ~~~html
> <input type="search" class="form-control form-control-lg" name="s" value="Katastrophe" id="search" />
> ~~~
Also musst Du zu einem geeignetem Zeitpunkt (onload?) folgendes feuern:
~~~js
var el = document.getElementById( "search" );
moveCursorToEnd( el );
~~~
HTML Input (Autofocus) mit value. Focus an das ENDE des Input Feldes
bearbeitet von ursus contionabundo> Hallo, 
> 
> danke für den Hinweis, leider ebenfalls ohne Änderung: 
> 
> ~~~HTML
> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" />
> ~~~
wird nicht mehr gebraucht. Ist "Vanilla-JS"
> ~~~js
> //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();
>     }
> }
> ~~~
Dein DOM-Element hat die ID "search":
> ~~~html
> <input type="search" class="form-control form-control-lg" name="s" value="Katastrophe" id="search" />
> ~~~
Also musst Du zu einem geeignetem Zeitpunkt (onload?) folgendes feuern:
~~~js
var el = document.getElementById("search");
moveCursorToEnd( el );
el.focus();
~~~
 nicht angemeldet
 nicht angemeldet