text() method no longer works after loading a text file

text() method no longer works after loading a text file

alert returns nothing.

  1. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

  2. <div id='first'></div>
  3. <p></p>
  4. <div id='second'></div>

  5. <script>
  6. $("#first").load("Matthew1.txt").css("white-space", "pre-line");
  7. var result=$("#first").text();
  8. alert(result);
  9. </script>

It seems $("#first").text() doesn't work after the load().