Javascript copy and paste with the use of clipboardData

  • 2020-03-30 04:09:52
  • OfStack

Window.clipboarddata can be used to copy and paste, its getData method can be used to read data, and setData method can be used to setData

 <script language="javascript"> 
function readTxt() 
function setTxt() 
var t=document.getElementById("txt");; 
<input name="txt" value=" test "> 
<input type="button" value=" copy " onclick="setTxt()"> 
<input type="button" value=" read " onclick="readTxt()">

Related articles: