Link to home
Start Free TrialLog in
Avatar of JoeTodd
JoeToddFlag for United States of America

asked on

control character echo in html input field with javascript or jquery

I want to test input characters as they are keyed into an <input type="text" field, and in some cases echo a different character than was received.  I need to do this as characters are keyed, not after the fact when the field loses focus.
I'm catching input characters now with a "keypress" event, but I'm having trouble re-displaying the modified input value.
I make the changes I need based on the input value (from event.which), chop off the last input character, concatenate the replacement character, then set that string as the value.  
The problem I'm having is that the modified string looks good, but then the originally keyed character shows up on the end of the new value string.
If I key a character that isn't being replaced the display works great.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JoeTodd

ASKER

Thanks for the reply.  I won't have an opportunity to try it until Sunday or Monday.  The fake transparent input should work.  Very creative solution, I hadn't thought of it.   I'll let you know what happens.
I'll leave the question open until then.
Thanks,
Joe Todd
what give your tests?
Avatar of JoeTodd

ASKER

Sorry for the delay in getting back.  Family emergencies prevented my dealing with work issues.
The fake transparent input worked great!  Thanks for your help.
ok cool, could you close the question please? thanks
Avatar of JoeTodd

ASKER

Creative solution.  Again, my apologies for asking a question before (unknowingly) being unable to process your answer more promptly.