DIV (content editable) cursor positions function
I am in the process of building a custom WYSIWYG text editor but am struggling to get started because I need it to be cross browser. I will be using a div for the text and images with event handlers for the controls (bold, italic etc). My problem is creating a function / functions which return the cursor position or the start and end positions (if text is highlighted).
Any advice is welcome
var e = document.getElementById('wysiwyg');
! What can I use here to get the selected index / cursor position !
<div id="wysiwyg" contenteditable>
TEXT GOES HERE
<input type="button" value="B" onClick="bold();">