Firing an event when the caret gets within a particular div/span/a tag and also, when the caret leaves the tag
问题 The idea is this - There is a contenteditable element with some text in it. Am trying to build out a tagging mechanism (kind of like twitter's people tagging when you type '@'). Whenever a user types '@', it shows up a popover with suggestions and filters when they continue typing. Until here it's easy and I have got it figured out. The problem comes when I need to show the popover if/only if the caret is over the element containing the tag. <div contenteditable=""> <p>Some random text before