Compare ID and attribute and apply class

Compare ID and attribute and apply class

I have this HTML structure:

<div id="our_mega_menu_wellness" class="our_mega_menu">
    <div>
        <div>
        <a class="subcat_menu1" onmouseenter="submenu_display(this.id)" id="wellness22" href="">Emotional Well-being</a>
        <a class="subcat_menu1" onmouseenter="submenu_display(this.id)" id="wellness24" href="">Home &amp; Family</a>
        </div>
        <div class="menu_article_content">
            <div data-id="wellness22">
            </div>
            <div data-id="wellness22">
            </div>
        </div>
    </div>
</div>

For eg:

When i hover over the link which has ID wellness22 content shows up which as data-id wellness22
I want href tag to be selected when i move my cursor in the content div which contains data-id wellness22.

Basically i want to compare both ID and data-id which has same values it should apply class to href dynamically