Hi,
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).
[CODE]
<script type=”text/javascript”>
function bold(){
var e = document.getElementById(‘wysiwyg’);
! What can I use here to get the selected index / cursor position !
}
</script>
<div id=”wysiwyg” contenteditable>
TEXT GOES HERE
</div>
<input type=”button” value=”B” onClick=”bold();”>
Any advice is welcome