javascript - Highlight part of text based on a given offset, html -


what best option achieving dynamic text highlighting based on given offset? want able show part of text showing in field highlighted based on predefined range.

for example consider following text:

"desired output range (0,13)".

i want show like:

"desired output range (0,13)".

is possible through javascript? if not, recommend?

i went , tried out in jsfiddle (this uses client-side javascript), solution native javascript jquery. note did use <code> tag achieve , use different tag if don't want regular styling comes <code> tag. don't know of solution doesn't involve usage of new html element though (which used).

http://jsfiddle.net/1jdmvgod/2/


Comments