The value
property is only available on user input elements, not <h3>
. And the change
event is only triggered when you change the value of an input element, it doesn't apply to <h3>
.
You can use textContent
to get the string in an <h3>
element. And if you want the action to happen when you click on it, use onclick
. So they should be like this:
<h3 id="taxes" onclick="taxesrepas(this.textContent)">taxes:</h3>
Also, in the function, you should move the calculations that use taxer
and pricer
to after the switch
statement that sets those variables.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…