Skip to content

Instantly share code, notes, and snippets.

@yuroyoro
Created April 8, 2009 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuroyoro/91676 to your computer and use it in GitHub Desktop.
Save yuroyoro/91676 to your computer and use it in GitHub Desktop.
getCurPosition_ie = function(id){
var elm = document.getElementById(id);
var docRange = document.selection.createRange();
var textRange = document.body.createTextRange();
textRange.moveToElementText(elm);
var range = textRange.duplicate();
range.setEndPoint("EndToStart", docRange);
var start = range.text.length;
return start;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment