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