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. By the way I am using a contenteditable
div element where I am trying to do this.
In all browsers it fails, I am using it on clicking a particular li
element of a ul
.
<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);
Mozilla (Opera too) requires special security setting .
Check this (preferably in 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.