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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts

    changing colour of some words in form inputs

    Hello,

    I have a search function that looks for specific words in fields from my database and returns them.

    I'd like to be able to highlight the search term in my output. So I have some php which inserts CSS styling whenever the search word appears.

    However, I'm outputting the results as part of a form, so the text is in inputs and textareas, and the styling doesn't seem to work inside here. All I want to do is simply make the word change colour or something, but not all the words in the input, just some of them if they match.

    What I'm getting is:

    Code:
    <textarea name="experience" id="experience" rows="12">3 <span style="color:#00CC33">horse</span>s 17.1 (selling) 15.2 1de and 14.1</textarea>
    So the CSS styling is outputting directly into the textarea. Is there any way to make this work?

    Thanks,

    Nicola

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,802
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    However, I'm outputting the results as part of a form,
    Your above approach is invalid. So let me ask, why? Can't you show that text inside a <div> or <p> ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts
    The text is being shown as part of a form so that the info can be updated immediately from this page, rather than having to then click edit and be taken to a copy of the same page with a form. Saves an extra click.

    Any ideas on how this could be done? I'm flexible in terms of how, but I do need the info in a form.

    Thanks,

    Nicola


  •  

    Posting Permissions

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