I want to read a text file and display the info in a div, and then replace the separator | with a <br/> so everything is on one line. I have it working fine so far but the .replace() only works once. I read up about this but couldn’t figure how to solve it.
Here is my code so far:
$.get('feed.txt', function(data) {
$('div').html(data.replace('|','<br>'));
});
you need to use a regex replace instead of a string replace:
note, you have to escape the ‘|’ character.