Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6878753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:45:44+00:00 2026-05-27T04:45:44+00:00

I use little script to clear text form content. It looks neat, but there

  • 0

I use little script to clear text form content. It looks neat, but there is one bug.

If I start writing, and just click somewhere within the form all content is deleted.

Any ideas how to fix this??

To see it in action visit:

http://www.sandrophoto.com/2011/11/28/five-photography-tips-from-celebrated-pros/#comment

Start writing something, than just click inside form. see? text gets removed, this is not the behavior I need.

code:

<textarea tabindex="4" rows="10" cols="100%" id="comment" name="comment"
    onclick="this.value='';" onfocus="this.select()"
    onblur="this.value=!this.value?'Write your comment':this.value;">
    Write your comment</textarea>

Is there a way to make this clear text action to happen only once with default text? and than remain static?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:45:45+00:00Added an answer on May 27, 2026 at 4:45 am

    You have 3 things happening within that textarea:

    1. onclick: Clear the textarea
    2. onfocus: Select this textarea
    3. onblur: if its blank, then replace it with Write your comment

    The one you need to edit is action 1. (onclick) because its clearing it everytime the user clicks regardless of what the current value is. You need it to only clear if the contents is the default ie: Write your comment.

    1. should be: onclick: if value is Write your Comment then clear otherwise do nothing.

    So your code should look like so:

    <textarea tabindex="4" rows="10" cols="100%" id="comment" name="comment"
      onclick="if (this.value=='Write your comment'){this.value='';}" 
      onfocus="this.select()"
      onblur="this.value=!this.value?'Write your comment':this.value;">
      Write your comment</textarea>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ended up writing a quick little script for this in Python, but I
I wanted to use groovy for a little ftp script and found this post
I've got a little Bash script that I use to access twitter and pop
There is little documentation on how to use the low level api for datastore
I'm a little confused as to which one I should use. I think either
I have a little script that replace some text, that come from a xml
hey guys i searched a lot but there is a little topics discussed about
Why did some processor manifacturers decide to use Little endian Big endian Middle endian
I'am new to Python 3 and could really use a little help. I have
I am writting a customized component which need to use the little triangle icon

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.