title: jquery change image path
body: <p>I've had to use a div with an image to cover the page due to issues with getting the background to stretch across the entire page in different browsers. </p>
  
  <p>What I'm trying to do is to get this image to change dependent on the time of day. I had it working fine when I was using the more conventional background-image property in CSS, but I'm having problems translating it over to change the src attribute of the image.</p>
  
  <p>The id of the image is #bg. I'm probably making a syntactical error, but any help would be great, thanks!</p>
  
  <pre><code>$('document').ready(function(){
  
   var hours = getDayTime(new Date().getHours());
  
  if (hours &gt; 20 || hours &lt; 5) {
      $('#page-background &gt; img').prop('src', 'backgrounds/night.jpg')
  }    
  
  else if (hours &gt; 17) {
      $('#page-background &gt; img').prop('src', 'backgrounds/dusk.jpg')
  }    
  
  else if (hours &gt; 8) {
      $('#page-background &gt; img').prop('src', 'backgrounds/day.jpg')
  }
  
  else { 
      $('#page-background &gt; img').prop('src', 'backgrounds/dawn.jpg')
  }
  });
  
  
  &lt;div id="page-background"&gt;&lt;img src="backgrounds/day.jpg" width="100%" height="100%" alt="" id="bg" /&gt;&lt;/div&gt;
  </code></pre>