title: Can't set the value of input with Javascript
body: <p>I'm trying to change the value of an input field with Javascript.<br>
  I tried everything, but nothing seems to works. I tried putting the 5 between quotation marks and using jquery. I also double-checked the array and everything.</p>
  
  <p>Here is the input code:</p>
  
  <pre><code>&lt;input type="number" id="id_[SOME_ID_HERE]" value="0"&gt;
  </code></pre>
  
  <p>and the loop used to update the values.</p>
  
  <pre><code>for (var i = 0; i &lt; shoppingCart.length; i++) {
      var val = shoppingCart[i];
      document.getElementById("id_" + val.substring(3)).value = 5;
  }
  </code></pre>
  
  <p>jsfiddle: <a href="http://jsfiddle.net/zkTud/" rel="nofollow">http://jsfiddle.net/zkTud/</a></p>
  
  <p>EDIT: Seems like it doesn't work with type="text" as well...</p>
  
  <p>EDIT2: Thank you everyone who answered. My problem was actually something else.<br>
  The input was loaded from another page, and it took time and the for loop I had problem with (see above) was executed before the file was done loading.<br>
  All I did was to move the for loop as is to the callback function and it works now.</p>
  
  <p>Thanks anyways!<br>
  <strong>I really appreciate the help I'm getting in this site! :)</strong></p>