Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

createTextRange code example

function selectText(areaId) {
    if (document.selection) {
      var range = document.body.createTextRange();
      range.moveToElementText(document.getElementById(areaId));
      range.select();
    } else if (window.getSelection) {
      var range = document.createRange();
      range.selectNode(document.getElementById(areaId));
      window.getSelection().removeAllRanges();
      window.getSelection().addRange(range);
    }
  }
Source by www.tabnine.com #
 
PREVIOUS NEXT
Tagged: #createTextRange #code
ADD COMMENT
Topic
Name
7+8 =