Stripping Special Characters out of an input field and writing them to another field


I need to write some JavaScript which will take the value of one field (as its typed) and copy this same value into another field except stripping out any special characters before doing so and replacing spaces with “-”.

The purpose of this is to generate search engine friendly page names based on the title of an article created in a content management system. Right now I can do this using server side scripting, but I wanted to do it client side so the user has the chance to adjust the file name if they so choose.

Input into field (A): “Question: Who’s reading this?”
Value of field (B): “question-whos-reading-this.htm”

I don’t really know where to begin, can anyone point me at a tutorial?


Its OK I found this…

Worked perfectly.