最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to detect contenteditable cursor position change Safari + iPad + IOS 7? - Stack Overflow

programmeradmin1浏览0评论

When using contenteditable (on HTML5) you can listen to click/touch and key events to detect when the cursor position changes. It seems on iPad / Safari nothing fires when using a touch event to reposition the cursor.

Is there a method to detect the cursor position change?

When using contenteditable (on HTML5) you can listen to click/touch and key events to detect when the cursor position changes. It seems on iPad / Safari nothing fires when using a touch event to reposition the cursor.

Is there a method to detect the cursor position change?

Share Improve this question edited May 8, 2014 at 14:44 Diodeus - James MacFarlane asked May 8, 2014 at 14:37 Diodeus - James MacFarlaneDiodeus - James MacFarlane 114k33 gold badges163 silver badges180 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

On WebKit and derivatives (including Safari, Chrome and Mobile Safari), and IE, you can use the selectionchange event of the document:

document.onselectionchange = function() {
    console.log("Selection changed!");
};

See also https://stackoverflow./a/13881312/96100

发布评论

评论列表(0)

  1. 暂无评论