Chinmaya
Chinmaya

Reputation: 1

document.execCommand paste not working in contentEditable div

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

Upvotes: 1

Views: 3620

Answers (1)

pepkin88
pepkin88

Reputation: 2756

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.

Upvotes: 1

Related Questions