IE 11 document.selection不起作用 [英] IE 11 document.selection does not work

查看:362
本文介绍了IE 11 document.selection不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试取消选择HTML编辑器中的选定内容.

I am trying to deselect selected content in HTML editor.

我已使用selection.empty()函数取消选择内容,在IE10之前它可以正常工作,但在IE11中则无法工作.而且create功能在IE11中不起作用

I have used selection.empty() function for deselecting content it is working fine up to IE10 but it is not working in IE11. Also the create function is not working in IE11

有其他替代功能吗?

推荐答案

IE11用更符合标准的API取代了旧版API.

IE11 replaced the legacy API with a more standards-compliant API.

selection不再受支持.从Internet Explorer 11开始,使用 getSelection .

selection is no longer supported. Starting with Internet Explorer 11, use getSelection.

请参见 IE11 .

HTMLSelection 现在返回对象,这与旧的

An HTMLSelection object is now returned, which is different to the old selection object and it doesn't look like empty is a valid method in the new API. Hopefully the new API will have methods that allow you to perform the same logic.

这篇关于IE 11 document.selection不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆