I created a simple code to copy some content to clipboard when i click on a specific Div (not an actual button) :
$("#myButtonDiv").on("click", function () {
var myText = ('<p style="color:#ff0000;">content 123</p>')
navigator.clipboard.writeText(myText);
});
However, this will copy the html code to clipboard; is there a way to copy the desired output instead ? (i.e. copy "content 123" in red)
Note : to be a little more precise, my variable myText is actually like that :
var myText = $('#myContentDiv').html();
Where #myContentDiv displays the desired output.
Thank you in advance !