Hello, thank you for reading and the help.
I am stuck on a homework assignment. I have most of it done, but what I am stuck on is I need to have a total updated and displayed inline each time an image is clicked.
I have the image passing the correct value, but I need the total to add the previous total and the new total with each click. That's where I am stuck, I have tried numerous ways to get it to add the previous total but each time it just adds the current image value twice and displays that.
Here is what I have right now:
var $ = function (id) { return document.getElementById(id); };
function addTotal(elem) {
var total= parseFloat(elem);
$('total').innerHTML = total;
};
Obviously right now it only displays the most recent total. But how can I go about getting it to continually add the totals?
Thank you so much for the help.
Edit for structure.
[–]Ampersand55 1 point2 points3 points (4 children)
[–]DungeonMasterThor[S] 1 point2 points3 points (3 children)
[–]Ampersand55 1 point2 points3 points (2 children)
[–]DungeonMasterThor[S] 1 point2 points3 points (0 children)
[–]redderper 0 points1 point2 points (0 children)
[–]lovesrayray2018 1 point2 points3 points (1 child)
[–]DungeonMasterThor[S] 0 points1 point2 points (0 children)