title: javascript onchange in form html?
body: <p>its working fine until i put the  tag on select category can someone help me a bit , after i put the tag  its just not working..</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function category(s1, s2) {
    var s1 = document.getElementById(s1);
    var s2 = document.getElementById(s2);
    s2.innerHTML = "";
    if (s1.value == "letters") {
      var optionArray = ["a|a", "b|b"];
    } else if (s1.value == "numbers") {
      var optionArray = ["1|1", "2|2"];
    } else if (s1.value == "soon") {
      var optionArray = ["|", "|", "|"];
    }
    for (var option in optionArray) {
      var pair = optionArray[option].split("|");
      var newOption = document.createElement("option");
      newOption.value = pair[0];
      newOption.innerHTML = pair[1];
      s2.options.add(newOption);
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form&gt;
    &lt;select id="category" onchange="category('category','subcategory')"&gt;
      &lt;option value=""&gt;&lt;/option&gt;
      &lt;option value="letters"&gt;Letters&lt;/option&gt;
      &lt;option value="numbers"&gt;Numbers&lt;/option&gt;
    &lt;/select&gt;
    &lt;br&gt;
    &lt;select id="subcategory"&gt; &lt;/select&gt;
    &lt;br&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>