Thank to all!

I do it!

function setCursorPosition(textArea, selOffset) {
    if (document.selection) { // IE, Opera
        var sel = document.selection.createRange();
        sel.collapse(true);
        sel.moveStart('character', selOffset);
        textArea.focus();
        sel.select();
        return true;
    } else if (window.getSelection) { // Mozilla/Netscape...
                var selection = window.getSelection();
                range = selection.getRangeAt(0);
                
range.setStart(range.startContainer,range.startOffset+selOffset);
                textArea.focus();
                return true;
    }
    return false;
}

Only one tible :(  -  in Opera this work incorrect.
Have you any idea?


On 9 янв, 16:50, "jQuery Lover" <ilovejqu...@gmail.com> wrote:
> You can't trigger but can achieve the same effect :)
>
> An you will definitely deal with Ranges to make your code cross browser :)
>
> jQuery HowTo Resource  -  http://jquery-howto.blogspot.com
>
> On Fri, Jan 9, 2009 at 7:43 PM, Ricardo Tomasi <ricardob...@gmail.com> wrote:
>
> > You can't actually trigger a keypress, only it's event listeners. I
> > think you'll have to deal with 
> > "ranges":https://developer.mozilla.org/En/DOM/Range
>

Reply via email to