We have a HTML page. Is it possible to select (by mouse) few words of a paragraph, get reference to those selected words and encapsulate them, say, by the <span>...</span> tag programatically? We can use jQuery or HTML5/CSS3?
We have a HTML page. Is it possible to select (by mouse) few words
Share
You can use a
mouseuphandler and usegetSelection. Say you have a div calledtesttagging, then this is a way to add a span to a selected text within that div. See this jsfiddle.[edit] adjusted for use with IE too. JsFiddle is also adapted