Return to Snippet

Revision: 7447
at July 25, 2008 06:45 by DesTincT


Initial Code
/* 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

});

Initial URL


Initial Description
Can use without jquery

Initial Title
Set text cursor to the begin/end of input/textarea

Initial Tags
jquery

Initial Language
JavaScript