<script> function copyToClipboard(element) { if(element == 1) var textBox = document.getElementById("myvalue"); else var textBox = document.getElementById("demo"); textBox.select(); document.execCommand("copy"); } </script> <input type="text" class="form-control" name="myvalue" id="myvalue" value="Merhaba Dünya!" readonly /> <button class="btn btn-primary btn-block" onclick="copyToClipboard(1)">Copy myvalue</button> <input type="text" class="form-control" name="demo" id="demo" value="Merhaba Evren!" readonly /> <button class="btn btn-primary btn-block" onclick="copyToClipboard(2)">Copy demo</button>
0 174