title: How to change background image with the help of querySelector
body: <p>i just wonder how to set the background image of a div block after using the queryselector. Below is my test. But none of this work.......Pls help.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;div class="A"&gt;
  &lt;h1&gt;Hello World!&lt;/h1&gt;
  &lt;button type="button" onclick="myFunction()"&gt;Set background image&lt;/button&gt;
  
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;script&gt;
  function myFunction()
  {
  document.querySelector(".A").style.background="yellow"; //work
  document.querySelector(".A").style.setProperty("backgroundImage", "url('2.jpg')")// not work
  document.querySelector(".A").style.backgroundImage = "url('2.jpg')" //not work
  }
  &lt;/script&gt;
  </code></pre>