title: Change html text input value using javascript
body: <p>how do you change text input value in html using javascript? In my case I want to change the price input of an item when the user selects the item and inputs the quantity, for example:</p>
  
  <pre><code>&lt;html&gt;
  ...
  &lt;body&gt;
  Quantity : &lt;input type="text" id="qty"/&gt;
  &lt;br/&gt;
  Item : &lt;select id="item" onClick="checkPrice()"&gt;&lt;option value="apple"&gt;Apple&lt;/option&gt;&lt;option value="orange"&gt;Orange&lt;/option&gt;&lt;/select&gt; //added onClick
  &lt;br/&gt;
  Price : &lt;input type="text" id="price"/&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>what i would like is when the user input the quantity and item, the price would be automatically inputted.</p>
  
  <p>i have tried this and it inputted NaN (not a number)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function checkPrice()
  {
  var a = document.getElementById("item").value;
  var b = document.getElementById("qty").value;
  if(a = "apple"){
  price = 5
  document.getElementById("price").value=b*price
  }else if(a = "orange"){
  price = 4
  document.getElementById("price").value=b*price
  }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Help please? Thank you.</p>