If you want to get the cursor position for a contentEditable div in webkit, and only webkit use selection.baseOffset:
console.log( window.getSelection( ).baseOffset );I put up a demo on my site here: cursor position for contentEditable in webkit demo