JSFiddle - React, Tailwind, and code Playground
by pastrocchio
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css">
<script src="http://rangy.googlecode.com/svn/trunk/currentrelease/rangy-core.js"></script>
<div id="texttocheck">This is our place for sharing information, so <i>make</i> sure to add any updates you have. </div>
JavaScript
var range = rangy.createRange();
startNode = document.getElementById("texttocheck");
range.setStart(startNode, 0);
range.setEnd(startNode, 4);
var word = range.toString();
console.log(word);
var newNode = document.createElement("span");
range.surroundContents(newNode);