Js setting cursor position problem

The

project uses its own numeric keypad. I want to insert the keyboard value into a pile of numbers, and then position the cursor after the insertion value

const contentRow= document.getElementById("contentRow")
const selection = getSelection();
const range = selection.getRangeAt(0);
range.setStart(contentRow.childNodes[0], offsetLength);
range.setEnd(contentRow.childNodes[0], offsetLength);
range.collapse(true);
selection.removeAllRanges();
selection.addRange(range);

offsetLength is the index value after inserting the value
and then I find that the cursor is always in the first place. I can"t go to offsetLength, and then try to locate it there with setTimeout, but it feels a little pause. Is there a better solution?

Feb.23,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c29f11-339c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c29f11-339c7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?