<html> <head> </head> <script type="text/javascript" language="javascript"> function f() { // how to copy text in div when Button Is clicked?! } </script> <body> <div style="width:200px;height:200px;background-color:gray;" id="div1"> abcdefgh </div> <input type="button" value="Copy" onclick="f();"/> </body> </html>
function CopyToClipboard() { CopiedTxt = document.selection.createRange(); CopiedTxt.execCommand("Copy"); }
$("#divID").html("Your div text");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)