编程基础:Js光标控制易错题[1] Programming foundation: Error-prone point [1] of cursor control by Js means

本文介绍了在使用Js操纵可编辑div中的光标选择单词时遇到的Range对象setStart方法报错问题。通过分析错误原因,发现编辑前后div结构变化导致的问题,并提供了解决方案,确保无论用户如何编辑,都能正确选取最后一个单词。
摘要由CSDN通过智能技术生成

Js Range对象的setStart方法报错解决方法

The solution to the exception of the object of Class, Range, in Javascript

前几天在做用Js操纵光标选中一个单词时,发现了这一个问题,虽然技术很白菜,但是网上一搜还真找不到很好的解决办法,亲自打了一下,将其"解决",解决的方法可能不是最优的,望大家指正.

Several days before, while trying to use Javascript to operate the cursor to select a word, I found an exception. Although the expertise to be used is as easy as ABC, there are absolutely no good solutions found on the Internet. Therefore, I put it down to earth and got it "settled", in whose solution there might be something cumbersome I am waiting for every viewer to point out

条件:HTML5,原生Js,jQuery插件(jquery-1.8.3.js)

Circumstance:HTML5,original Js and jQuery plug-in(jquery-1.8.3.js)

要求:一个可编辑div中有一个多个单词hybrid,用Js操纵光标,选中最后一个hybrid.

Requirement: In a content-editable div in which there are m

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

英语声声

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值