title: Loading a .txt file and breaking lines with javascript
body: <p>So I currently have hundreds of .txt files I am using a function to grab and load into a DIV, though as is parses the file it doesn't appear to be accounting for format or line breaks. I have tried both the .split() &amp; .replace() to no avail, I have tried assigning a separate string variable to load it into then applying the split/replace, as well as using split/replace directly on the file before loading it, and lastly as apart of the string variable in the .load() </p>
  
  <p>I would like it to at least brek all the correct lines in the .text file this is what I am using:</p>
  
  <pre><code>var clickedLink = "";
  var fileOpen = "";
  
  $(".load-content").click(function() {
      clickedLink = $(this).attr("title");
      fileOpen = "txt/" + clickedLink;
  });
  
  $(document).ready(function() {
      $('.load-content').click(function() {
          $('#mainLetter').load(fileOpen);
      });
  }); 
  </code></pre>
  
  <p>This works great for getting the info from the link and loading it onto the page but trying combinations of <code>.replace(/(?:\r\n|\r|\n)/g, '&lt;br /&gt;');</code> &amp; <code>.split("\n").join("&lt;br /&gt;")</code> I am having no luck in getting the .txt file looking half way normal on the screen.</p>
  
  <p>Any help would be appreciated</p>