用户在此处输入一些字符串,并且该字符串包含Mahi为子字符串。我试图将光标Mahi放在单击按钮的末尾吗?
.html
<div id="demo" contenteditable="true"></div>
<button id="btn" onclick="focusAtMen()"></button>
js
// lets suppose user input is "Hi.......Mahi, .....?";
// here dots may be any characters
focusAtMen(){
var editor = document.getElementById("demo");
// set focus on `contentEditable div` and `place cursor at the end` of `Mahi` , thats a user Input.
}
相关分类