title: using javascript to output html
body: <p>I have a javascript link that references another .js file. I've been trying to output an image (for testing purposes), but I'm not sure what is the correct way to go about this.</p>
  
  <pre><code>    alert("beginning");
      //var link = $("&lt;a href='http://juixe.com'&gt;Hello, &lt;b&gt;World&lt;/b&gt;!&lt;/a&gt;");
      //$('body').append(link);
      //document.write("hi");
      //document.write("&lt;div&gt;&lt;img src='http://s3-media2.ak.yelpcdn.com/bphoto/xqC6Iy5mOLb_8mwMKGv8_w/l.jpg' /&gt;&lt;/div&gt;");
      alert("before function");
  (function(){
  
  
  
      alert("middle");
      var links = $("&lt;a href='http://juixe.com'&gt;Hello, &lt;b&gt;World&lt;/b&gt;!&lt;/a&gt;");
      $('body').append(links);
      alert("after middle");
      //alert($("img").attr("id"));
      document.write("hi");
      document.write("&lt;div&gt;&lt;img src='http://s3-media2.ak.yelpcdn.com/bphoto/xqC6Iy5mOLb_8mwMKGv8_w/l.jpg' /&gt;&lt;/div&gt;");
  
      alert("end");
  }());
  </code></pre>
  
  <p>I was able to alert beginning, all the way to middle. It seems like <code>var links</code> doesn't work. I'm trying to use HTML inside this <code>.js</code> file. Essentially, I want to be able to do some modal window, but I'm trying to output images for testing purposes right now. </p>
  
  <p>Also, is this the correct way for jquery?</p>
  
  <p>Thanks in advance!</p>