40
rated 0 times
[
44]
[
4]
/ answers: 1 / hits: 19652
/ 7 Years ago, mon, december 4, 2017, 12:00:00
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>
More From » jquery