怎样插入docx到汉文末尾_将插入符移动到输入或文本区域的末尾

怎样插入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光标移到INPUTTEXTAREA元素的末尾。 那可能是用户想要的最后一件事。 当我找到这个gem时,我正在浏览Stack Overflow:该函数可在命令中将光标移动到INPUTTEXTAREA的末尾!


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!

只需将元素传递到上面的函数,您就会看到插入符号移动到元素的末尾! 浏览器中的插入符号管理很糟糕,但是此功能使其变得异常简单。 请享用!

翻译自: https://davidwalsh.name/caret-end

怎样插入docx到汉文末尾

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值