javascript - Show result into input text -
i have code calculate results (multipliers * 5) , shows me results <div id="total"></div>
<script type="text/javascript"> function calculate(multiplier) { var product = multiplier*5; document.getelementbyid('total').innerhtml = product; } </script> <form> <select name="multipliers" onchange="calculate(this.value)"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> <div id="total"></div> <!-- result displayed here --> <input type="text" id="total" readonly="readonly"> </form>
is possible show results input text not div ?
<input type="text" id="total" readonly="readonly"> <!-- i'd show result here -->
yes can... try this
document.getelementbyid('total').value = product;
but better have unique ids. remove div if not using anymore or give id textbox
Comments
Post a Comment