Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    encodeURIComponent

    Hello!

    I am using encodeURIComponent(document.title) to grab the title for something I need... I was wondering, since my page titles are long and annoying for SEO purposes, can I just get up to the first instance of ":" in the title?

    Example page title:
    Article Title : Category : Website

    I just want to grab the "Article Title" part up to the first ":"!

    Thanks for any help!

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    Code:
    var pageTitle = documen.title;
    var arr = pageTitle.split(" : ");
    alert(arr[0]);


  •  

    Posting Permissions

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