Funny Money Calculator Help

The result of the calculation in my JS on line 12 isn’t being printed to #total in the DOM. What am I missing or doing wrong? The code makes sense to me but apparently doesn’t make sense to the computer. Thank you for any effort to help me with this. Here’s the codepen link. https://codepen.io/creativecodepenuser/pen/JjbVQxY

you can’t get the value in the moment the script is loaded, it meens you are not getting the values put in via input

add a check to see what hourlyWage , mle and workHours are

1 Like

How do I add a check to see what hourlyWage , mle and workHours are? Thanks.

You can use console.log() to check the values.


Anyway, you can move getting the value from the elements inside the function.

BTW, you have to put the inputs inside a form element to have the constraints work (i.e. the required attribute). You can add an event listener on the form element for the submit event (remember to use preventDefault to stop the form submit) and get the input values on submit instead.

1 Like