[Solved] HTML – Calling Javascript Function with variable? [closed]


You could always do something like this. Maybe change the divs around a bit and add a rounding system. This gives you a live update on the costs when selecting how many keys.
https://jsfiddle.net/8hube9ua/

Throw this under your select,

          <span data-val="1.85">1.85</span> <!--How much each key is-->

then throw this into the script.

<script>
$('#suiface').change(function(){
   var span = $(this).next('span');
   span.text(span.data('val') * parseInt(this.value,10)) //multiplies the cost by the option selected
})
</script>

5

solved HTML – Calling Javascript Function with variable? [closed]