title: javascript calculate price and view it immediately after i insert a number in form (input type='number')
body: <p>How can i  to calculate a price and show it immediately after I insert a number in my form ? I try this but the it shows me the price after i press submit.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function myFunction() {
          var price = document.getElementById("number").value * 5;
          return price;
      }
      document.getElementById("demo").innerHTML = myFunction();
  &lt;/script&gt;
  
  &lt;td&gt;
      &lt;input type="number" name="numberofpages" id="number" value="&lt;?php if(isset($_POST['nrpagini'])){ echo $_POST['nrpagini'];}else{ echo '';}?&gt;"&gt;
  &lt;/td&gt;
  &lt;td id="demo"&gt;&lt;/td&gt;
  </code></pre>
  
  <p>When i insert a number in form I want to multiplicate numberofpages with 5 and show me immediately the price.Thanks!</p>