title: jQuery - Add element once the screen width is below 500px
body: <p>I would like to add an element to the body once the width of the screen is below 500px. I used the code below but the element does not appear. Hopefully somebody is able to help me out?</p>
  
  <pre><code>$(window).resize(function(){
  if ($(window).width() &lt;= 500){  
    $("body").append("&lt;a href="#"&gt;Home&lt;/a&gt;");
  } });
  </code></pre>