JQuery / script cheatsheet
Revision as of 11:17, 6 September 2017 by old>Admin (Created page with " ==== Selecting text for easy copying ==== var textNode = document.getElementById('opusNode'); if (document.selection) { var range = document.body.createTextRange();...")
Selecting text for easy copying
var textNode = document.getElementById('opusNode'); if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(textNode); range.select(); } else if (window.getSelection) { var selection = window.getSelection(); var range = document.createRange(); range.selectNodeContents(textNode); selection.removeAllRanges(); selection.addRange(range); }