title: How to add image to button via Javascript?
body: <p>I am trying to add image to buttons I have using Javascript but I can't seem to get it working. I have sucessfully added image using HTML5, however, for my needs I need to add the image via javascript.</p>
  
  <p>Below is what I have written to add images via HTML.</p>
  
  <pre><code>&lt;button class="button" id="Ok"&gt;&lt;img src="images/ok.png"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>Below is what I have tried to add image via Javascript but it doesn't seem to work.</p>
  
  <pre><code>var buttons = document.getElementsByClassName("button");
  for (var b = 0; b &lt; buttons.length; b++) {
        buttons[b].src = "images\ok.png";   
    }
  </code></pre>
  
  <p>I am not to sure what I am doing wrong, any help would be nice. Thanks.</p>