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
    Oct 2012
    Posts
    5
    Thanks
    2
    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
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,159
    Thanks
    23
    Thanked 599 Times in 598 Posts
    IF
    ...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.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Posting Permissions

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