0

I can't manage to take over input values from the selection in a calculation. What am I doing wrong?

Depending on your selection it should take over the number of the 'car' and use it for the calculation formula.

<select name="car">
  <option value="9">Volvo</option>
  <option value="8">Saab</option>
  <option value="7">Fiat</option>
  <option value="6">Audi</option>
</select>

<form onsubmit="return false" oninput="amount.value = apple.valueAsNumber + cherry.valueAsNumber + apple.valueAsNumber + cherry.valueAsNumber * car.valueAsNumber">
  <input type="number" min="0" id="apple" name="apple" value="0"></p>
  <input type="number" min="0" id="cherry" name="cherry" value="0"></p>
  <input type="number" min="0" id="car" value="0" name="car"></p>
  <output name="amount" for="cherry apple car">0</output>
</form>
j08691
  • 204,283
  • 31
  • 260
  • 272

0 Answers0