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 Microsuck's Avatar
    Join Date
    Oct 2011
    Location
    127.0.0.1
    Posts
    123
    Thanks
    44
    Thanked 5 Times in 5 Posts

    Make Default Text Disappear On Click?

    I have a textarea, and it has the default text set to "Write your post in here..."

    When a user clicks the textarea, I need that default text to disappear, so the user doesn't have to hit backspace.

    If you look at the top of CodingForums.com, you can the Google custom search bar, if you click inside the box, "Google Custom Search" goes away. That's what I need my textarea to do. How can I do this?
    PHP Code:
    <?php echo "Microsuck says hi!"?>

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,348
    Thanks
    23
    Thanked 618 Times in 617 Posts
    It is not an attribute to the textarea tag. It must be done via javascript.


    Code:
    <textarea cols="25" rows="5" onclick="document.getElementById('area').innerHTML='';" id="area" >Write your post in here...</textarea>

  • Users who have thanked sunfighter for this post:

    Microsuck (11-03-2011)

  • #3
    Regular Coder Microsuck's Avatar
    Join Date
    Oct 2011
    Location
    127.0.0.1
    Posts
    123
    Thanks
    44
    Thanked 5 Times in 5 Posts
    Thank you!
    PHP Code:
    <?php echo "Microsuck says hi!"?>


  •  

    Posting Permissions

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