Created
August 24, 2009 17:09
-
-
Save othree/173967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function moveLast(target) { | |
if (target.nodeName.toLowerCase() != 'input' || target.type != 'text') return false; | |
var pos = target.value.length; | |
target.focus(); | |
if (target.createTextRange) { | |
var range = target.createTextRange(); | |
range.move("character", pos); | |
range.select(); | |
} else if (target.setSelectionRange) { | |
target.setSelectionRange(pos, pos); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment