Position cursor

I was wondering if theres a way to position the cursor to the postition that is 1 past the last character of the textarea. The code below puts the cursor at the last position but i need it to go 1 more space to the right:

        function setCursorAtTheEnd(aTextArea,aEvent) {
            var end = aTextArea.value.length;
            if (aTextArea.setSelectionRange) {
                setTimeout(aTextArea.setSelectionRange,0,[end,end]);
            } else {
            var aRange = aTextArea.createTextRange();
            aRange.collapse(true);
            aRange.moveEnd('character', end);
            aRange.moveStart('character', end);
            aRange.select();
            }
            return false;
        }

You’ll need to add a space to the end of the text (if one doesn’t already exist), to achieve that.