views:

66

answers:

1

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);

A: 

Mozilla (Opera too) requires special security setting.

Browsers compatibility.

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.

pepkin88