Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text field manipulation question

Status
Not open for further replies.
Joined
Mar 22, 2007
Messages
1
Location
US
I have 2 text boxes let's call them Text Box 1 and Text Box 2.
When someone enters text into Text Box 1, I want the text to appear in Text Box 2. I also want to change any spaces entered in Text Box 1 to change to dashes(-). I know how to make the text appear on Text Box 2 when someone types in text in Text Box 1 but I can't seem to figure out how to change spaces to dashes. Please let me know if anyone can point me in the right direction. Thanks.
 
Something like this in Textbox 1 (untested)
Code:
onkeydown="document.forms[formnamehere].elements['Textbox 2'].value = this.value.replace(/ /g, '-');"

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top