title: Change background image using jquery and escape double quotes
body: <p>I want to change the background image using jquery.</p>
  
  <p>the user enter the url to his background in an input text and when clicking a button the background image change, simple as that.</p>
  
  <p>this is the code i used.</p>
  
  <pre><code>$(".change_bg").on("click",function(e){
  
      e.preventDefault();
  
      var bg = $(".bg_input").val();
  
      $("table").css("background-image", "url("+bg+")");  
  
  });
  </code></pre>
  
  <p>this code works great.</p>
  
  <p>My problem is when i open firebug i see this.</p>
  
  <pre><code>&lt;table style="background-image: url("the_new_background-image");" &gt;
  </code></pre>
  
  <p>How can i remove the double quotes inside the url and get this.</p>
  
  <pre><code>&lt;table style="background-image: url(the_new_background-image);" &gt;
  </code></pre>
  
  <p>The whole HTML code will be sent to a server and get downloaded, so when i try to open the downloaded HTML file in the browser the background image doesn't show up.</p>
  
  <p>i try to us this code and replace the double quotes but i didn't succed.</p>
  
  <pre><code>$("table").css("background-image", ("url('"+bg+"')").replace(/"/g,""));
  </code></pre>
  
  <p>Please some one help.</p>