So I'm working on a project where I'm inputting a quantity and I want it to calculate the totalcost of the item based on the input quantity and a pre-defined cost. Then after calculating the total cost it would send that back to the HTML document. Ideally it would be dynamic.
Here's a jsfiddle with a psuedo-code. I can't seem to figure it out but I believe that it would be done with DOM which I'm really new too.
Any help would be appreciated! I'm working on something a bit more complex, but I feel that if I can see a more basic example then I can figure out what doesn't want to click for me and I can move forward. I'll keep researching and reading, let me know if I haven't included enough information!
Rough HTML
<form>
<input id="quantity" class="qty" type="text" placeholder="quantity" />
</form>
<!--display total cost here-->
<span>The Cost is: totalcost</span>
Rough Javascript
var cost = 25;
function(updater) {
var quantity = document.getElementById('quantity').value();
var totalcost = (cost * quantity);
send total back to html document and display as total cost
}