View Single Post
Old 02-19-2013, 05:03 PM   PM User | #2
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 961
Thanks: 0
Thanked 198 Times in 193 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
Quote:
Originally Posted by xelawho View Post
I need to find the contenteditable div that a text node belongs to
I would have thought this would do it:
Code:
function getEditableParent( elem )
{
  while( elem && !elem.parentNode.contentEditable )
    elem = elem.parentNode;
 
  return  elem ? elem.parentNode : null;
}
Logic Ali is offline   Reply With Quote