[英]document.execCommand paste not working in contentEditable div
document.execCommand
paste not working, ie it works only when a selection has been made and it replaces the selected contents, otherwise no change is made. document.execCommand
粘贴不起作用,即,仅当做出选择并替换所选内容时才起作用,否则不做任何更改。 By the way I am using a contenteditable
div element where I am trying to do this. 顺便说一句,我在尝试这样做的地方使用了一个contenteditable
div元素。
In all browsers it fails, I am using it on clicking a particular li
element of a ul
. 在所有浏览器中,它都会失败,我在单击ul
的特定li
元素时会使用它。
<ul>
<li>
<a href="javascript:void(0)"onclick="paste();"><span>Paste</span></a>
</li>
</ul>
Where paste is the function where I use: document.execCommand('paste',false,null);
我在哪里使用粘贴功能: document.execCommand('paste',false,null);
Mozilla (Opera too) requires special security setting . Mozilla(Opera也是)需要特殊的安全设置 。
Browsers compatibility. 浏览器兼容性。
Check this (preferably in IE) . 选中此项(最好在IE中) 。 While you click the link, the focus is changing and the browser wants to paste data into that link. 单击链接时,焦点正在改变,浏览器希望将数据粘贴到该链接中。 I hope it will help you. 希望对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.