I have been struggling with this for a few days. I need somebody to steer me in the right direction. I have been searching on the web. I am not sure if I took the right approach
I would do something like this:
It will go through and find all else
words, and wrap them in a span with a listener bound:
What else would you say?
-
var hello = document.getElementById('hello');
var str = hello.innerHTML;
str = str.replace( /\b(else)\b/g, '$1' );
hello.innerHTML = str;
function func1() {
alert('there');
}
Check out the fiddle.