title: javascript Dropdown menu always opens at a specific location
body: <p>i have a javaScript Drop Down menu which i'am displaying in table row along with some other data . so when i click on the first menu button it opens like it should , slightly below the button , but when i press the menu button for the other rows of data below i the menu always opens in the position of the first row of the table .</p>
  <p>long story short i click the dropdown menu and menu appears somewhere else away from the button .</p>
  <p>my javascript</p>
  <pre><code>/* click on the button, 
  toggle between hiding and showing the dropdown content */
  function myFunction() {
    document.getElementById(&quot;myDropdown&quot;).classList.toggle(&quot;show&quot;);
  }
  
  // Close the dropdown 
  window.onclick = function(event) {
    if (!event.target.matches('.dropbtn')) {
      var dropdowns = document.getElementsByClassName(&quot;dropdown-content&quot;);
      var i;
      for (i = 0; i &lt; dropdowns.length; i++) {
        var openDropdown = dropdowns[i];
        if (openDropdown.classList.contains('show')) {
          openDropdown.classList.remove('show');
        }
      }
    }
  }
  </code></pre>
  <p>the CSS</p>
  <pre><code>.dropbtn {
  background-color: #027581;
  color: white;
  padding: 3.5px;
  font-size: 16px;
  border: none;
  cursor: pointer;
  border-radius: 10%;}
  
  
  
   .dropbtn:hover, .dropbtn:focus {
  background-color: #2980B9;  }
  
  .dropdown {
  position:relative;
  display:flex;
  text-align: left; }
  
  
  
  .dropdown-content {
  display: none;
  position:absolute;
  background-color: #f1f1f1;
  max-width: 150px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1; }
  
  show {display:block;}
  </code></pre>
  <p>the html</p>
  <pre><code>&lt;div class=&quot;dropdown&quot;&gt;
  &lt;button onclick=&quot;myFunction()&quot; class=&quot;dropbtn&quot;&gt;Action ▼&lt;/button&gt;
  &lt;div id=&quot;myDropdown&quot; class=&quot;dropdown-content&quot;&gt;
  &lt;a href=&quot;user_profile.php&quot;&gt;View&lt;/a&gt;
  &lt;a href=&quot;#&quot;&gt;Delete&lt;/a&gt;
  </code></pre>
  
  
  <p>any help i appreaciated</p>