title: Can't get if/else function to work with radio buttons
body: <p>I have looked all over this site (and Google) for an answer to my problem but I can only seem to find bits and pieces, nothing specific. </p>
  
  <p>I am primarily playing around with JavaScript and HTML but am <em>not</em> trying to use jquery right now. </p>
  
  <p>So, with that said, this is what I'm trying to do: I would like the user to enter two numbers, select an operation (add, subtract, multiply, divide) out of a list of four radio buttons, and then click a button which is linked to a function that does the math and then presents it in a text box on the page. How would I do this using only HTML and JavaScript? I have gotten everything to work up until the point I add the radio buttons.</p>
  
  <p>The code is as follows: </p>
  
  <pre><code>&lt;script&gt;
  function operationForm (form) {
      var x = document.operationForm.getElementById("numberOne");
      var y = document.operationForm.getElementById("numberTwo");
      var operation;
      var answer;
      if (document.operationForm.addSelect.checked === true) {
          answer = x + y;
          document.operationForm.answerBox.value = answer;
      } else if (document.operationForm.subtractSelect.checked === true) {
          answer = x - y;
          document.operationForm.answerBox.value = answer;
  
      } else if (document.operationForm.multiplySelect.checked === true) {
          answer = x * y;
          document.operationForm.answerBox.value = answer;
  
      } else(document.operationForm.divideSelect.checked === true) {
          answer = x / y;
          document.operationForm.answerBox.value = answer;
  
      }
  }
  &lt;/script&gt;
  
  &lt;h1&gt;Let's calculate!&lt;/h1&gt;
  
  &lt;form name="operationForm"&gt;
  &lt;p&gt;
      &lt;label&gt;Enter two numbers, select an operation, and then click the   button below.
          &lt;p&gt;
              &lt;label&gt;Number One:
                  &lt;input type="text" name='numbers' id="numberOne"&gt;
                  &lt;br&gt;
                  &lt;br&gt;Number Two:
                  &lt;input type="text" name='numbers' id="numberTwo"&gt;
                  &lt;p&gt;
                      &lt;input type="radio" name="operations" id="addSelect" value=''&gt;Add
                      &lt;input type="radio" name="operations" id="subtractSelect" value=''&gt;Subtract
                      &lt;input type="radio" name="operations" id="multiplySelect" value=''&gt;Multiply
                      &lt;input type="radio" name="operations" id="divideSelect" value=''&gt;Divide
                      &lt;label&gt;
                          &lt;p&gt;
                              &lt;input type="button" value=" Calculate " onClick='operationForm(form);'&gt;
                              &lt;p&gt;
                                  &lt;label&gt;Your answer is:
                                      &lt;input type="text" name="answerBox"&gt;
  </code></pre>
  
  <p>If anyone has any fixes or can point me in the right direction of the correct syntax for handling radio buttons, functions linking to them, and onClick events linking to those functions, it would be extremely appreciated.</p>