title: CSS and JQuery: spaces inside image name break code of url()
body: <p>I have a page that is supposed to display a larger version of an image when hovered over a thumbnail. </p>
  
  <p>I have a 'div' with an ID and the JQuery code is as following:</p>
  
  <pre><code>$(document).ready(function(){
  
    $('img').hover(function() {
  
      var src = $("#im" + this.id).attr("src");
      $('#viewlarge').css('backgroundImage','url(' + src +')'); 
      return false;
    });
  
  });
  </code></pre>
  
  <p>The images I use, are generated by a Ruby script that "generate" an image with a similar, yet different id. However, sometimes, photo's are uploaded that have "spaces" inside. My developer tools tell me that the background-image is not set correctly, yet the image path is correct and the browser don't have problems finding the image.</p>
  
  <p>My question is, can I somehow sanitize the url 'src', so spaces won't be a problem? I am aware of doing this server side, yet I would like to know how to do this with JQuery/JS too.</p>
  
  <p>Thanks!</p>