I have figured out how to update my html dynamically based on the current input of a form. However, I am stumped with how to perform any math on this value (i.e. value*5), and display that result, instead of merely displaying the value in the form.
Here is a live example: https://dl.dropboxusercontent.com/u/14749627/happy2/number.html
Here is my JavaScript:
<script>
window.onload = function() {
var purchase_quantity = document.getElementById('purchase_quantity');
purchase_quantity.onclick = updateNameDisplay;
purchase_quantity.onclick = updateNameDisplay;
purchase_quantity.onclick = updateNameDisplay;
function updateNameDisplay() {
document.getElementById('nameDisplay').innerHTML = this.value || "1";
}
};
</script>
purchase_quantity.onclick = updateNameDisplay;?document.getElementById('nameDisplay').innerHTML = this.value*5 || "1";?