title: How to get value from dropdown menu in bootstrap 4?
body: <pre><code>&lt;li class="nav-item dropdown"&gt;
                  &lt;a class="nav-link dropdown-toggle toggle2" href="#" id="navbarDropdown2" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt;
                      Material Type
                  &lt;/a&gt;
  
  
                  &lt;div class="dropdown-menu menu2" aria-labelledby="navbarDropdown2"&gt;
                      &lt;a class="dropdown-item"&gt;Mud&lt;/a&gt;
                      &lt;div class="dropdown-divider"&gt;&lt;/div&gt;
                      &lt;a class="dropdown-item"&gt;Cloth&lt;/a&gt;
                      &lt;div class="dropdown-divider"&gt;&lt;/div&gt;
                      &lt;a class="dropdown-item"&gt;Thread&lt;/a&gt;
                      &lt;div class="dropdown-divider"&gt;&lt;/div&gt;
                      &lt;a class="dropdown-item"&gt;Jute&lt;/a&gt;
                      &lt;div class="dropdown-divider"&gt;&lt;/div&gt;
                      &lt;a class="dropdown-item"&gt;Cotton&lt;/a&gt;
                      &lt;div class="dropdown-divider"&gt;&lt;/div&gt;
                      &lt;a class="dropdown-item"&gt;Cane&lt;/a&gt;
                      &lt;div class="dropdown-divider"&gt;&lt;/div&gt;
                      &lt;a class="dropdown-item"&gt;Bamboo&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/li&gt;
  </code></pre>
  
  <p>Can I get the value from the menu after selecting like following?</p>
  
  <pre><code>var email=document.getElementById('signUpEmail').value;
  </code></pre>
  
  <p>So that I can use this variable in ajax.  </p>
  
  <p><strong>Edit</strong><br>
  As @Timir suggest to use select then the menu is look like  </p>
  
  <pre><code>&lt;li class="nav-item"&gt;
  &lt;select class="custom-select custom-select-lg mb-3" id="mydropdown"&gt;
    &lt;option selected&gt;Material Type&lt;/option&gt;
    &lt;option value="Mud"&gt;Mud&lt;/option&gt;
    &lt;option value="Cloth"&gt;Cloth&lt;/option&gt;
    &lt;option value="Thread"&gt;Thread&lt;/option&gt;
    &lt;option value="Jute"&gt;Jute&lt;/option&gt;
    &lt;option value="Cotton"&gt;Cotton&lt;/option&gt;
    &lt;option value="Can"&gt;Can&lt;/option&gt;
    &lt;option value="Bamboo"&gt;Bamboo&lt;/option&gt;
  &lt;/select&gt;
  &lt;/li&gt;
  </code></pre>