hi Greeg,

Probably you've found solution for your question but because I had
faced the same problem as you, and it get me a while to find out
solution i'll answer just in case somebody else will meet the same
problem.
Check this page
http://codeclimber.net.nz/archive/2008/04/11/Beware-the-.-in-jQuery-elementId--document.getElementByIdelementId.aspx

In case if it's offline:

The problem is because JQuery always return array even if
documentation say that should be one element, so use $('#id')[0] to
get clean dom object :)

On Aug 27, 1:18 pm, Greeg <[EMAIL PROTECTED]> wrote:
> i know its of the annoying topics but...
> im using this function to set cursor position:
>
> function setSelectionRangeX(input, selectionStart, selectionEnd) {
>    // IE
>    if (input.createTextRange) {
>       var range = input.createTextRange();
>       range.collapse(true);
>       range.moveEnd('character', selectionEnd);
>       range.moveStart('character', selectionStart);
>       range.select();
>     // real browsers :)
>     } else if (input.setSelectionRange) {
>       input.focus();
>       input.setSelectionRange(selectionStart, selectionEnd);
>     }
>
> }
>
> while im sending input object as
> "document.getElementById('myTextarea')" all works fine, but when ill
> try to use jQuery selector "$('#myTextarea')" it just set the cursor
> position at the end of the field, without any err message or warning.
>
> so the seems to be that $('#myTextarea').setSelectionRange returns
> 'undefined'.
>
> im kind of a noob with jquery, but all other built-in function works
> fine even if they are applied on jq-selected object, so i dont really
> know whats happening :(
>
> annyone knows hw to "fix" this?

Reply via email to