title: How to get the selected value on select tag using JavaScript?
body: <p>I have a select statement like this:</p>
  
  <pre><code>&lt;select onchange="change_session()" name="select_path" id="select_path"&gt;
      &lt;option name="sserver_id" id="select_path" selected value="{{ i.id }}"&gt;{{ default_server_id }}&lt;/option&gt;
      {% for i in all_server_id %}
          &lt;option name="server_id" id="select_path" value="{{ i.id }}"&gt;{{ i.session_name }}&lt;/option&gt;                 
      {% endfor %}
      &lt;/select&gt;
  </code></pre>
  
  <p>The first option show the <code>default_id</code> on the top and the second options lists all the options. User can change the option and process accordingly which is send to server using AJAX. Now I want to find out which <code>server_id</code> has user selected using JavaScript like this:</p>
  
  <pre><code>var serverId=document.getElementById('server_id');
  </code></pre>
  
  <p>How can I get the selected option?</p>