Display cursor at the end of a textarea


#1

Hi
I have searched various places and tried various ways of coding, but I’m unable to display the cursor at the end of a textarea (or to move there to show the last entry).
Any suggestions, please?
Cheers Paul


#2

Did you check the docs here?

https://wiki.nsbasic.com/TextArea

There are some selection* properties which can be set.


#3

Yes, thanks
Have tried various combos: :frowning:

TextArea2.text = TextArea2.text + ". " + ‘\n’ + ‘\n’ + Select1.text;
aaa = TextArea2.length;
//TextArea2.setSelectionRange(aaa,aaa);

TextArea2.selectionEnd;

//length = TextArea2.selectionEnd - TextArea2.selectionStart;
//selectedText = Mid(TextArea2.value, TextArea2.selectionStart + 1, length);
//this.scrollTop = 999999;
//scrollTo(aaa,aaa);
};


#4

Which Textarea control are you using?


#5

Yes, using JQM, thanks


#6

Are you setting the focus to the TextArea? This worked for me:

Form2.onshow=function(){
  TextArea1.focus();
  TextArea1.setSelectionRange(3,3)
}

#7

Thank you so much! I also used blur to hide the keyboard :slight_smile: