By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,252 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,252 IT Pros & Developers. It's quick & easy.

How to store the last character of a textbox in a variable

P: 3
Hi
Can any one help me,I want to store the last character typed in a textbox in a variable,and next time when the user enters another character ,the last chracter
gets added to the previous character.
Plz reply soon
Sep 8 '08 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
You can use the onkeyup event to set the variable.

What have you managed so far?
Sep 8 '08 #2

rnd me
Expert 100+
P: 427
Expand|Select|Wrap|Line Numbers
  1. <input onkeydown="this.last=this.value.slice(-1,1)" onkeyup="this.value+=this.last" >
Sep 9 '08 #3

freddieMaize
P: 85
...and next time when the user enters another character ,the last chracter
gets added to the previous character.
Hi,

May i know what exactly you mean by "next time" here

Regards
fREDDIE
Sep 9 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.