Hello and welcome to our community! Is this your first visit?
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
    Oct 2012
    Thanked 0 Times in 0 Posts

    Remove part of text

    Hi all,

    I have a basic html document, in which the word "$text" is replaced by a php form emailing script to anything like "Sun|Moon|Jupiter" or "Night|Day|Morning" etc...

    My question. Using javascript, is there a way to remove all text inserted by the php script, begining with the first pipe character? So all text that remains is "Sun" or "Night" ? Please consider that in the html document I only have the word "$text". Also, please take into consideration that I am a complete javascript illiterate....

    Thank you!!

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Thanked 789 Times in 787 Posts
    ...snip...in the html document I only have the word "$text".
    Makes no sense. PHP renders the HTML, it does not wonk 'on the HTML'. If you have $text in the HTML it stays that way. PHP can not change it. Only javascript can change the HTML.

    If you have access to the PHP, change it there. I think we need to see the code of the HTML and the PHP.
    Evolution - The non-random survival of random variants.

    Because I love FLEXBOX and tired of waiting: http://davidwalsh.name/goodbye-vendor-prefixes


Posting Permissions

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