I'm trying to write some simple JS code for estimating the summary price from two values. And then print it out on screen, but it doesn't work with multiple changes and e.t.c.
How should i print out the result?
<script type="text/javascript">
window.onload = function() {
var take = document.getElementsByClassName("take");
var size1 = document.getElementsByName("size1").value;
var size2 = document.getElementsByName("size2").value;
take.addEventListener("click", plus, false);
function plus() {
var result = parseInt(size1)+parseInt(size2);
document.getElementsById("summa_order").value = result;
}
}
</script>