document.getElementById(new_div_name).innerHTML = replybox;
document.getElementById(new_div_name).scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"});
document.getElementById(new_div_name).innerHTML = replybox;
document.getElementById(new_div_name).scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"});
-
- // Set cursor on focus
- tag.focus();
-
- // cursor
- var sel = window.getSelection();
- sel.collapse(tag.firstChild, 0);
-
+ tag.focus(); // sets the focus
+ window.getSelection().collapse(tag.firstChild, 0); // positions the cursor