Copy To Clipboard JQuery
Jan 5, 2021
In this small tutorial I will explain you how to copy text from one field to another field using java script, many time we have requirement to copy text value one field to another field, like current address and permanent address are same in this criteria copy to clipboard is useful to save our time.
So here I will give you some piece of code how to copy to clipboard using JQuery.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Copy To Clipboard Using JQuery-websolutionstuff.cpm</title>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
alert("Success");
$("textarea").select();
document.execCommand('copy');
}); });
</script>
</head>
<body>
<textarea id="comment" rows="5" cols="50"></textarea>
<p><button type="button">Get Value</button></p>
<p><strong>Note:</strong> Type something in the textarea and click the button to see the output.</p>
</body>
</html>
And Don’t Forgot to Like, Share and Claps.
Thanks For Reading !!