How can I select the contents of the whole page using jQuery for later to be copied to clipboard and hence another WYSIWYG.
The case is:
$("#SelectAll").click(function(){
//CODE TO SELECT ALL THE CONTENTS OF THE CURRENT PAGE
/* PS:
$("body").focus();
$("body").select(); //doesn't work
*/
});
Any help is appreciated.
Thanks
FOUND THE SOLUTION:
function selectAll()
var e = document.getElementsByTagName('BODY')[0];
var r = document.createRange();
r.selectNodeContents(e);
var s = window.getSelection();
s.removeAllRanges();
s.addRange(r);
}
This works in FF haven't tested in other browsers. Just need to call selectAll wherever I want.