Read More link to Copied Text... the line breaks and formatting are ignored
Page 1 of 1
Read More link to Copied Text... the line breaks and formatting are ignored
I am using this code to add a read more link to my copied text but the line breaks and formatting are ignored:
- Code:
$(document).ready(function () {
document.body.oncopy = function () {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "<br />Read more at: <a href='" + document.location.href + "'>" + document.location.href + "</a><br />";
var copytext = selection + pagelink;
var newdiv = document.createElement('div');
body_element.appendChild(newdiv);
newdiv.innerHTML = copytext;
selection.selectAllChildren(newdiv);
window.setTimeout(function () {
body_element.removeChild(newdiv);
}, 0);
};
});
How to preserve them?
There is a good code: http://jsfiddle.net/acdcjunior/XKjNz/9/
But doesn't work here.
Ahmed.K- Forumember
- Posts : 349
Reputation : 4
Language : English
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum