I know this a repeat question, but I tried a lot of things and none of them worked. Essentially, I have:
var med = word.replace("!", '<br />');
(div.get(0)).textContent = med;
I can't see the whole of your code so I'm not sure what your HTML looks like. Try this code:
var str = jQuery('p').html(); str = str.replace('!', '<br />'); jQuery('p').html(str);
There is a jsFiddle here: https://jsfiddle.net/pavkr/bq8be893/
You could simplify the code but this is basically just to show you how it works.