怎样插入docx到汉文末尾
One of the annoying parts of using the focus method of HTML elements is that they don't move the cursor to the end of INPUT
or TEXTAREA
elements if they already have content in them. That's probably the last thing a user would want. I was browsing through Stack Overflow when I found this gem: a function that moves the cursor to the end of an INPUT
or TEXTAREA
on command!
使用HTML元素的focus方法的烦人之处之一是,如果它们已经包含内容,它们就不TEXTAREA
光标移到INPUT
或TEXTAREA
元素的末尾。 那可能是用户想要的最后一件事。 当我找到这个gem时,我正在浏览Stack Overflow:该函数可在命令中将光标移动到INPUT
或TEXTAREA
的末尾!
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();
}
}
Simply pass the element to the function above and you'll see the caret move to the end of the element! Caret management in the browser sucks, but this function makes it incredibly easy. Enjoy!
只需将元素传递到上面的函数,您就会看到插入符号移动到元素的末尾! 浏览器中的插入符号管理很糟糕,但是此功能使其变得异常简单。 请享用!
怎样插入docx到汉文末尾