Javascript: Backspace in a textbox

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Javascript: Backspace in a textbox

Post 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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Google it: Javascript character codes
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post 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
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post 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.
Last edited by Roja on Tue Jun 13, 2006 2:54 pm, edited 2 times in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post 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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post 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".
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I found it thanks!
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post 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.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Yeah, now that I think about it, some kinda are but w/e, that life, you have to live with ppl.
Post Reply