1

Is there a simple way of checking, whether the caret is at the very first, or last position in a contenteditable? I know that there are ways of getting the caret position, e.g., Get a range's start and end offset's relative to its parent container, but I was wondering, whether there is a simpler method, if I only want to know if the caret is at the top/bottom of the div.

What I try to do is to automatically move the caret to the previous/next div, if it has reached the top/bottom of the currently focused div. The HTML structure is simply

<div contenteditable=true id="div1">something here</div>
<div contenteditable=true id="div2">something else</div>

http://jsfiddle.net/v923z/92FWk/

Thanks,

Community
  • 1
  • 1
v923z
  • 1,237
  • 5
  • 15
  • 25
  • http://stackoverflow.com/a/7478420/96100 – Tim Down Oct 10 '13 at 08:43
  • Thank, Tim, this looks interesting. So, the bottom line is that there is no native method/functions for this, one has to mess with selections/ranges. – v923z Oct 10 '13 at 09:21

0 Answers0