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

When using contenteditable (on HTML5) you can listen to clicktouch and key events to detect when the c

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745152588a4613934.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信