So how would you suggest I fix it? Its for an assignment so the stress id building
The text box shows but no value is in it, Im trying to get the total to update in there
Well, this works fine for me. Are there errors in the lines I have omitted? Use alerts to inspect the values. And as Logic Ali would say, use your error console.
Code:
<script type = "text/javascript">
var ToppingTotal= 0;
function AddBacon(){
ToppingTotal +=1;
document.getElementById("ToppingCost").value = ToppingTotal;
}
</script>
<input type="text" id="ToppingCost">
<input type="button" onclick="AddBacon()" value="Add Bacon" />
</body>
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.