How to put focus at the end of an input with React.js
Pretty easy to do, but couldn't find it in 1 minute so posting here :)
moveCaretAtEnd(e) {
var temp_value = e.target.value
e.target.value = ''
e.target.value = temp_value
}
render() {
<textarea
value={value}
autoFocus
onFocus={this.moveCaretAtEnd}
></textarea>
}
Written by MichalHantl
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#React.js
Authors

cleechtech
13.08K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#