IE 11 document.selection does not work [closed]

好久不见. 提交于 2019-11-30 08:52:42

问题


I am trying to deselect selected content in HTML editor.

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

Is there any alternative function for this?


回答1:


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

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

See Compatibility changes in IE11.

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.



来源:https://stackoverflow.com/questions/21777728/ie-11-document-selection-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!