We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

addRange Redirect 1

Summary

Adds a Range to a Selection.

Syntax

sel.addRange(range)

Parameters

range
A Range object that will be added to the Selection.

Examples

/* Select all STRONG elements in an HTML document */

var strongs = document.getElementsByTagName("strong");
var s = window.getSelection();

if(s.rangeCount > 0) s.removeAllRanges();

for(var i = 0; i < strongs.length; i++) {
  var range = document.createRange();
  range.selectNode(strongs[i]);
  s.addRange(range);
}

Document Tags and Contributors

Last updated by: Sheppy,