removeChild sometimes removes entire span and sometimes doesn't
I'm working on a rich text editor for iOS and have most of it working but running into endless problems ensuring that the cursor is visible in the viewport when the user starts typing. I came up with a novel approach: insert a span at the cursor position, scroll to the span, and then remove it. (I haven't gotten to only scrolling if the span is on-screen.) Here's what I wrote: document.addEventListener('keypress', function(e) { jumpToID(); }, false); function jumpToID() { var id = "jumphere2374657"; var text = "<span id='" + id + "'> </span>" document.execCommand('insertHTML', false, text);