Making dropdown lists run function

I have adapted some code from the W3 hoverable dropdown tutorial and want to make it so that rather than following a link when clicked, it passes a value to a function. A rough snippet of the HTML code is below:

<div class="dropdown">
    <button class="dropbtn">Item</button>
    <div class="dropdown-content" (change)="selectChange($event)">
        <a value="egg">Egg</a>
        <a value="milk">Milk</a>
    </div>
</div>

I want to figure out how to get the value "egg" into the JavaScript function selectChange if the user clicks on that box, but currently, the boxes are not clickable and don’t do anything. I would like to avoid using a <select> tag if possible.

Here is the W3 link I got the structure of this code from:
https://www.w3schools.com/howto/howto_css_dropdown.asp