jQuery prependTo function not working as expected

jQuery prependTo function not working as expected

Hello Everyone: 

I am doing an exercise using prependTo function. instead of appending before the paragraph in the HTML body. The text appeared on a separate line. 

Could you explain to me how appendTo and prependTo works, so I understood its behavior. Thanks!

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  3. <html>

  4. <head>
  5.   <title>hello world</title>
  6.   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  7.   <link rel="stylesheet" href="stylesheet1.css" type="text/css" />
  8.   
  9.   <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" ></script>
  10.  <script language="JavaScript" type="text/javascript">
  11.  
  12.   <!--
  13.   $(document).ready(function(){
  14.    var p1= $('<p>use preappend to add some text</p>').prependTo('#disclaimer');;
  15.   
  16.  //$('p1').prependTo('#disclaimer'); //doesn't work as expected append the text before paragraphy with id = disclaimer
  17.   });
  18.   //-->
  19.  </script>
  20. </head>

  21. <body>
  22.   <p id="disclaimer">this is a legal statement of our website</p>
  23. </body>
  24. </html>
  25.