I found the following code here on SO to get the cursor position of a contenteditable div, however it always returns 0.
Function to get position:
new function($) { $.fn.getCursorPosition = function() { var pos = 0; var input = $(this).get(0);
The code I use to verify it:
$('div.MESSAGE_OF_DAY').keyup(function() { alert($(this).getCursorPosition());
I use Chrome (8.0.552.215) if that makes a difference.
source share