SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Oct 2003
    Location
    Tenerife, Spain / UK
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    Hi

    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?

    Thanks
    David Parkes
    Nuclear Internet - Windows Web Hosting
    http://www.nuclearinternet.com

  2. #2
    SitePoint Addict
    Join Date
    Oct 2003
    Location
    Tenerife, Spain / UK
    Posts
    329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting a string to slug with JavaScript

    Its OK I found this.. http://dense13.com/blog/2009/05/03/c...ug-javascript/

    Worked perfectly.
    David Parkes
    Nuclear Internet - Windows Web Hosting
    http://www.nuclearinternet.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •