I know how to copy the value of the input, as shown below, but when I try to do the same in a paragraph - for example, it doesn't work, let me know how to solve it?
$(function() {
$('input').click(function() {
$(this).focus().select();
document.execCommand("copy");
});
$('p').click(function() {
$(this).select();
document.execCommand("copy");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type='text' readonly value='click to copy me'>
<p>This is a pararaph</p>