title: Set background image in CSS using jquery
body: <p>I am trying to set the background image for one of my html element using jquery</p>
  
  <pre><code>&lt;div class="rmz-srchbg"&gt;
      &lt;input type="text" id="globalsearchstr" name="search" value="" class="rmz-txtbox"&gt;
      &lt;input type="submit" value="&amp;nbsp;" id="srchbtn" class="rmz-srchico"&gt;
      &lt;br style="clear:both;"&gt;
  &lt;/div&gt;
  
  $("#globalsearchstr").focus(function(){
      $(this).parent().css("background", "url(/images/r-srchbg_white.png) no-repeat;");
  });
  </code></pre>
  
  <p>but this never works.On focus only change happens is that a style attribute is added to HTML, like this</p>
  
  <pre><code>&lt;div class="rmz-srchbg" style=""&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>No change in CSS happens.</p>