Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>[The previous solution was not compatible with Chrome (WebKit?)]</p> <p>IF, a BIG if, the extra content is appended to the end of the input, the exercise below may offer the solution:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function btnGoOnClick(ctrl) { //-- For this POC the text content is reset to 160 lines of dummy text - //---------------------------------------------------------------------- ctrl.value = ""; for (var i = 0; i &lt; 160; ++i) { ctrl.value += "dummy!\n"; } //-- Then the carret is set to the last position ----------------------- //---------------------------------------------------------------------- if (ctrl.createTextRange) { //-- IE specific methods to move the carret to the last position var textRange = ctrl.createTextRange(); textRange.moveStart("character", ctrl.value.length); textRange.moveEnd("character", 0); textRange.select(); } else { //-- Mozilla and WebKit methods to move the carret ctrl.setSelectionRange(ctrl.value.length, ctrl.value.length); } //-- For WebKit, the scroll bar has to be explicitly set --------------- //---------------------------------------------------------------------- ctrl.scrollTop = ctrl.scrollHeight; //-- Almost there: make sure the control has fucos and is into view ---- //---------------------------------------------------------------------- ctrl.focus(); ctrl.scrollIntoView(false); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="form"&gt; &lt;input type="button" name="btnGo" value="Go!" onClick="btnGoOnClick(document.form.text);" /&gt; &lt;div style="height: 1000px"&gt;&lt;/div&gt; &lt;textarea name="text" rows="80"&gt;&lt;/textarea&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload