How to get different selected values in javascript?
<p>Hello everyone how can I get two values from different select boxes? I get first value in my select box but I can't get the second value from another select box.Here is my javascript code:</p>

<pre><code>       &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;

 $(document).ready(function () {
              var select = document.forms[0].sel;
              var select2=document.forms[0].sel2;
              select.onchange = function () {
                  var value = select.options[select.selectedIndex].value; // to get Value
               alert(value);

              }
               select2.onchange = function () {
                  var value2 = select2.options[select2.selectedIndex].value; // to get Value
               alert(value2);

              }

          });

        &lt;/script&gt;

 &lt;form&gt;
&lt;SELECT NAME="sel" onChange="split(selected value)"&gt;
&lt;OPTION VALUE=1&gt;Milk&lt;/option&gt;
&lt;OPTION VALUE=2&gt;tea&lt;/option&gt;
&lt;OPTION VALUE=3&gt;water&lt;/option&gt;
&lt;OPTION VALUE=4&gt;coffee&lt;/option&gt;
&lt;/SELECT&gt;
&lt;/form&gt;

 &lt;form&gt;
&lt;SELECT NAME="sel2" onChange="split(selected value)"&gt;
&lt;OPTION VALUE=1&gt;Milk&lt;/option&gt;
&lt;OPTION VALUE=2&gt;tea&lt;/option&gt;
&lt;OPTION VALUE=3&gt;water&lt;/option&gt;
&lt;OPTION VALUE=4&gt;coffee&lt;/option&gt;
&lt;/SELECT&gt;
&lt;/form&gt;
</code></pre>
