I have created a very simple javascript:
function dropdownFunction() {
document.getElementById("dropdown").classList.toggle("show");
}
With the following HTML:
<div class="dropdown">
<button onclick="dropdownFunction()" class="dropbtn">Dropdown</button>
<div id="dropdown" class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
This works, however as you would expect when I used the same HTML code to create a second dropdown button, when clicked it opens the first buttons dropdown menu. I was wondering whether or not it would be possible to modify that script so that I can use that function for all dropdowns, as oppose to having to create new functions for every dropdown button I use on the website.