Page 1 of 1
Javascript: Backspace in a textbox
Posted: Tue Jun 13, 2006 1:51 pm
by tecktalkcm0391
What is the code to backspace in a textbox on a click of a button. Like in the textbox it says "hellos" and you click the button on the screen and it backspaces to "hello". Really it would be numbers since this is for a calculator but you get my drift.
Posted: Tue Jun 13, 2006 2:26 pm
by pickle
Google it: Javascript character codes
Posted: Tue Jun 13, 2006 2:38 pm
by tecktalkcm0391
Thats not what I am asking. I want to know the code to backspace a digit or number from the contents of a textbox so if it says this orginally.
123456
and the user clicks a button on my site, then it will make the value
12345
Posted: Tue Jun 13, 2006 2:50 pm
by Roja
tecktalkcm0391 wrote:Thats not what I am asking.
That is what you are asking. You need the character code for backspace. Do as he suggested, and google your answer.
The second result has backspace as the
first listed code.
Take that, and some onchange/onsubmit javascript, acting on the textbox id. Done.
Posted: Tue Jun 13, 2006 2:51 pm
by pickle
Oh, my mistake.
What have you tried? You've been around these boards to know you don't get code without at least putting in some effort

You'd want to get the value, then get a substring of that value of length - 1.
Posted: Tue Jun 13, 2006 3:00 pm
by tecktalkcm0391
What I did was searched google for like 30 mintues trying to find how to do it and all I got was the character code and its 8, now
You'd want to get the value, then get a substring of that value of length - 1.
Is what i don't know how to do.
Posted: Tue Jun 13, 2006 3:05 pm
by pickle
I'm sorry, but that's darn easy to research for yourself. I'm not spending my time to explain it to you.
Posted: Tue Jun 13, 2006 3:11 pm
by Roja
tecktalkcm0391 wrote:What I did was searched google for like 30 mintues trying to find how to do it and all I got was the character code and its 8, now
You'd want to get the value, then get a substring of that value of length - 1.
Is what i don't know how to do.
You are not even trying.
The function in javascript is even *CALLED* substring.
http://www.novell.com/documentation/ext ... ngsJS.html
First google result for "javascript substring".
Posted: Tue Jun 13, 2006 3:20 pm
by tecktalkcm0391
I found it thanks!
Posted: Wed Jun 14, 2006 1:41 am
by Benjamin
Sometimes finding things can be difficult if you don't know what you are searching for. Some of the posts in here are downright rude.
Posted: Wed Jun 14, 2006 3:17 am
by tecktalkcm0391
Yeah, now that I think about it, some kinda are but w/e, that life, you have to live with ppl.