diff options
Diffstat (limited to 'web/scripts3.js')
-rw-r--r-- | web/scripts3.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/scripts3.js b/web/scripts3.js index ca1fafa1..8be4d551 100644 --- a/web/scripts3.js +++ b/web/scripts3.js @@ -96,6 +96,25 @@ function openSocialWindow(url) { if(window.focus) w.focus(); } +/******************************************************************************/ + +jQuery.fn.selectText = function(){ + var doc = document; + var element = this[0]; + console.log(this, element); + if (doc.body.createTextRange) { + var range = document.body.createTextRange(); + range.moveToElementText(element); + range.select(); + } else if (window.getSelection) { + var selection = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); + } +}; + /* * jQuery.fn.autoResize 1.14 */ |