Here we will see How to Copy Text with Additional Content JavaScript or jQuery. Just copy below code in your javascript file or page file with script tag :

 function codecanal_addLink() {
        //Get the selected text and append the extra info
        var selection = window.getSelection(),
            pagelink = '<br /><br /> Read more at: ' + document.location.href,
            copytext = selection + pagelink,
            newdiv = document.createElement('div');

        //hide the newly created container = 'absolute'; = '-99999px';

        //insert the container, fill it with the extended text, and define the new selection
        newdiv.innerHTML = copytext;

        window.setTimeout(function () {
        }, 100);

    document.addEventListener('copy', codecanal_addLink);
There are currently no comments.