Javascript form help

I am trying to use Javascript to create a form that will add the values of a radio box, checkbox and multiply it by a number from a dropdown to display a total e.g. (order form). Need help checking the JS as can’t get anything to appear…

https://codepen.io/lucinda-conder/pen/MWaxgjB?editors=1010

I added a console.log(totPrice) line right before the setInnerHtml line, and then the console began throwing errors around line 11.

  1. It’s not getElementByName, its getElementsByName:
    https://www.w3schools.com/jsref/met_doc_getelementsbyname.asp

But once that’s fixed, you still get NaN for the radio value, because
2. Getting the value of a selected radio button is a bit more complex:
https://www.dyn-web.com/tutorials/forms/radio/get-selected.php

Adding to what themagicbean has already posted; here are some links to relevant W3 topics MDN page.

https://www.w3schools.com/jsref/dom_obj_radio.asp

https://developer.mozilla.org/en-US/docs/Web/API/NodeList


As for the input at the bottom not calculating as you intended. You should have a closer look at what attribute the input element displays.

https://www.w3schools.com/html/html_form_attributes.asp