title: JavaScript, output in calculator
body: <p>I have a problem with my very simple calculator in JS. 
  I want it to show the result in a box but I don't know what it is that I'm doing wrong. 
  There is probably some more things in my code that might not be right...
  Please help me!</p>
  
  <p>Javascript:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.getElementById('submit').onclick=function() {
   num1 = parseFloat(document.getElementById('valueA').value);
   num2 = parseFloat(document.getElementById('valueB').value);
   arithmeticOperator = document.getElementById('arithmeticOperator').value;
   
   switch(arithmeticOperator) {
    case '+':
     result = num1 + num2;
     break;
    case '-':
     result = num1 - num2;
     break;
    case '*':
     result = num1 * num2;
     break;
    case '/':
     if(num2 != 0)
     {
      result = num1 / num2;
     }else {
      result = 'Dela inte med 0!';
     }
     break;
    default:
     result = 'Error';
   }
   document.getElementById('calcForm').onclick=output;
  window.alert('result');
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
   &lt;title&gt;blabla&lt;/title&gt;
   &lt;meta charset="utf-8"/&gt;
  &lt;script src="js.js" defer&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;form name="calcForm" id="calcForm"&gt;
    &lt;p&gt;&lt;input type="number" name="valueA" placeholder="Värde A" /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;input type="number" name="valueB" placeholder="Värde B" /&gt;&lt;/p&gt;
  
    &lt;select name="arithmeticOperator"&gt;
     &lt;option value="+"&gt;Addition&lt;/option&gt;
     &lt;option value="-"&gt;Subtraktion&lt;/option&gt;
     &lt;option value="/"&gt;Division&lt;/option&gt;
     &lt;option value="*"&gt;Multiplication&lt;/option&gt;
    &lt;/select&gt;
    &lt;button type="submit"&gt;Räkna ut&lt;/button&gt;
    
    &lt;p&gt;&lt;output name="result" form="calcForm"&gt;&lt;/output&gt;&lt;/p&gt;
   &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>:)</p>