Hello Guys I want to copy input value yeah on button click But nothing work. Please Help!!
<script>
function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).text()).select();
document.execCommand("copy");
$temp.remove();
}
</script>
<input type="text" class="form-control" name="myvalue" id="myvalue" value="YEAH" readonly />
<button class="btn btn-primary btn-block" onclick="copyToClipboard('#myvalue')">Copy myvalue</button>
function copyToClipboard() {
var textBox = document.getElementById("myvalue");
textBox.select();
document.execCommand("copy");
}
<input type="text" class="form-control" name="myvalue" id="myvalue" value="YEAH" readonly />
<button class="btn btn-primary btn-block" onclick="copyToClipboard()">Copy myvalue</button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With