I have a tootip div in my component. I need to change the position of the tooltip according to the hovered element. How can I do it without using jquery?


Use the native javascript for that. The following methods are useful while positioning an element:

// First get the element
var e = document.getElementById("you-element-id");
  • e.position
  • e.style.top / e.style.bottom
  • e.style.left / e.style.right
  • e.style.clientX / e.style.clientY

And try to search for some DOM positioning tutorials on the web.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.