document.execCommand
paste not working, i.e 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);