I have a div which has this list of suggestions. But i need to allocate it at the caret position of the textarea. Is this possible if yes, help me to do it.
function findOffsetPosition(obj) {
var posX = obj.clientLeft; var posY = obj.clientTop;
while (obj.offsetParent) {
if (obj == document.getElementsByTagName('body')[0]) { break }
else {
posX = posX + obj.offsetParent.offsetLeft;
posY = posY + obj.offsetParent.offsetTop;
obj = obj.offsetParent;
}
}
var posArray = [posX, posY]
return posArray;
}