/ Published in: JavaScript
Can use without jquery
Expand |
Embed | Plain Text
/* to the END */ $('textarea').each(function(){ //change event or something you want /* simple js */ if (this.createTextRange) { var r = this.createTextRange(); r.collapse(false); r.select(); } $(this).focus(); //set focus }); /* to the BEGIN */ $('textarea').each(function(){ //change event or something you want /* simple js */ if (this.createTextRange) { var r = this.createTextRange(); r.collapse(true); r.select(); } $(this).focus(); //set focus });
Comments
Subscribe to comments
You need to login to post a comment.

do you have an example of this somewhere?
easiest way is that: after page load use this script to focus on textbox:
document.formname.textboxname.focus();
than if you if you changed text value and want to go to end of this textbox, write that: document.formname.textboxname.value=document.formname.textboxname.value;
thats all folks :)