Click here to Skip to main content
15,904,346 members

Comments by LighthouseCall (Top 17 by date)

LighthouseCall 17-Apr-15 5:42am View    
You sir, are the man!
Thank you so much, works perfectly.
I wish you a great weekend!

LighthouseCall 17-Apr-15 5:36am View    
Not sure if this can help, so far what I understood is that we need some kind of HTML node rather than a text one.

http://www.w3schools.com/js/js_htmldom_nodes.asp
LighthouseCall 17-Apr-15 5:20am View    
Trying to debug and see what I can do, but I'm a bit clueless with all this new code.
with 'range.insertNode(span)' the selected text simply disappears.
I put alert(span); to check span is not somehow losing it's value, which is not the case.
LighthouseCall 17-Apr-15 5:05am View    
Hey! It's sticking to the selected/highlighted one now, but instead of making it bold I actually get the '<span style="font-weight:bold;">' in the text.

Once again, thanks for your answer. I don't want to take up too much of your time, you've been very helpful.
LighthouseCall 17-Apr-15 4:32am View    
Hi, thankyou for your answer, I had no idea about this. However, I tested your line of code;
document.body.innerHTML = document.body.innerHTML.replace(new RegExp(highlight , 'g'), span);

and now all the instances turn bold. (like in the example above, all hello's would go bold.

Thank you for you answer though.