I am looking for Javascript expertise to be able to find specific words after mySQL outputs my text. I have numerous fields in a column in my phpmyadmin database with sentences such as: Bobby ran down the hill. He saw nothing. Bobby went home.
I would like to create a javascript code that finds the periods . and be able to replace them with html code <br> because I cannot add a line break in the mySQL fields even though I've tried concatenation. Help on this issue would be appreciated!
Here is my script:
$("#tips").append("<li class='treatment'>" + treat.Tips + "</li>");
$("#tips-text").text(treat.Tips);
treat.Tips = txt.replace(/\./g, "<br />");
$('#tips').listview('refresh');`
<br>on the front-end.treat.Tipsafter you added that string the DOM? Just updatingtreat.Tipsis not going to update the DOM. You have to call$("#tips").append("<li class='treatment'>" + treat.Tips + "</li>");after you run your regex