PDA

View Full Version : strip text using javascript


wickedbob
08-09-2002, 10:52 AM
is there a way to strip unwanted characters from a text entry using javascript?
appreciate any help

BoB.

ShdwStal
08-09-2002, 11:41 AM
Check out the code on this page:
http://www.draac.com/stripper.html

mordred
08-09-2002, 11:41 AM
Yes, there are a lot of techniques you can use to "strip" unwanted characters from strings. Apart from the ordinary string methods you can also try those that deal with Regular Expressions. Perhaps the string.replace() function is of use to you

var str = document.blah.bloh.value;
str = str.replace(/\d/g, ""); // replaces all numerical digits from str