[SalesForce] Lightning problem with component.find(“”).getElements()

I have a component

<div class="tooltip" onmouseover="{!c.hover}">
    <div >
            <div >
               Test Test Test
            </div>
    </div>
    <div aura:id="textId" class="tooltiptext">
        <div>Test Code</div>
    </div>
</div> </aura:component>

Css applied is

.THIS.tooltip { 
    position: relative;
    display: inline-block; 
}  

.THIS .tooltiptext { 
    visibility: hidden; 
    position: absolute; 
    word-wrap:break-word; 
    text-align: justify; 
}  

.THIS.tooltip:hover .tooltiptext {
    visibility: visible; 
}

now in controller i want to use

hover :(component){ component.find("textId").getElements(); }

error i am getting is

[component.find(…).getElements is not a function]

this error occurs if locker service is enabled.

Is there any way to use component.find("").getElements() on div which is hidden?

Best Answer

I have done some POC on this component and found out that i was using component.find("") on textId div on init of component. then afterwards whenever i was trying to use component.find(“textId”).getElements() on that div it was giving error because component.find(“textId”) was returning secure component reference. i changed my init method and added my logic onmouseover event now i am able to use component.find(“”).getElements().