【问题标题】:Move cursor to end of contenteditable [duplicate]将光标移动到 contenteditable 的末尾 [重复]
【发布时间】:2011-08-09 02:47:11
【问题描述】:

可能重复:
How to move cursor to end of contenteditable entity

如何将光标移动到内容可编辑 div 的末尾?我只需要一个适用于 webkit 的解决方案,我不关心 ie 或 ff 这里。 越短越好。 :-)

【问题讨论】:

  • 是的,但是接受的答案不适用于 contenteditable div,这就是我的问题
  • 欢迎来到 SO @Leticia。上述 Q 的第二个答案是否回答了您的问题:stackoverflow.com/questions/1125292/…
  • 嘿,这确实有效!谢谢
  • @Jason,你能把它作为答案发布吗?它不会让我发布自己的答案,再过 6 个小时。

标签: javascript html contenteditable


【解决方案1】:

您查看的第一个答案适用于 textarea,但不适用于 contenteditable 元素。

此解决方案用于将插入符号移动到 contenteditable 元素的末尾。

How to move cursor to end of contenteditable entity

【讨论】:

  • 谢谢,效果很好。
猜你喜欢
  • 2012-11-10
  • 2011-12-17
  • 2021-11-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-08
  • 1970-01-01
相关资源
最近更新 更多