I have a code which if I selected some text and then clicked copy it works.
My problem if I not select any text and click copy
then I must copy all text.
My HTML:
<textarea id="txt" style="width:100%;height:100px;">To enjoy good health</textarea>
<div align="center"><button class="btn-md">copy</button></div>
My Script:
$(document).ready(function(){
$('.btn-md').click(function(){
$('#txt').focus();
document.execCommand('copy');
});
});