JR
asked on
How to execute the command Ctrl + C in Javascript
How to execute the command Ctrl + C in Javascript for a text box
ASKER
Need to trigger the Ctrl+C command in Javascript
Hi,
Please try below code (also attached demo HTML file):
Please refer this article for more details.
Hope this helps.
Regards,
Ronak
test9.html
Please try below code (also attached demo HTML file):
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function copyText()
{
var copied = txt.createTextRange();
copied.execCommand("Copy");
}
</script>
</head>
<body>
<input type="text" id="txt" />
<input type="button" id="btn" onclick="copyText();" value="Copy Text !!" />
</body>
</html>
Please refer this article for more details.
Hope this helps.
Regards,
Ronak
test9.html
ASKER
@Ronak, Thanks.
This works only in IE. Any other way that will work in all browsers other than flash support.
This works only in IE. Any other way that will work in all browsers other than flash support.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Please refer this if you can find any work around : Selection and range methods in JavaScript
Regards,
Ronak
Please refer this if you can find any work around : Selection and range methods in JavaScript
Regards,
Ronak
http://forums.asp.net/t/1816320.aspx?Ctrl+c+Ctrl+v+not+working+on+textboxes