how to clear up text field on click?

How do you make default text in the text field?

  • I want text to appear in the text field by default, like to say "Put your description here" but then when you click on it, it disappears. Similar to when asking a question on yahoo answers, it says "What would you like to ask" and then when you click there to type, it goes away? (i'm using ruby on rails if that's needed) ThANKS

  • Answer:

    Hello, Basically to make the text appear by default it is: <input type='text' value='Your Default Value' name='fieldname' id='fieldid' /> And you have to use javascript to remove the text. Before he </head> section add the following script <script language='javascript'> function removedefault() { var elm = document.getelementbyid('fieldid'); elm.value = ""; } </script> And rewrite the input box as: <input type='text' value='Your Default Value' name='fieldname' id='fieldid' onclick="removedefault();" /> That should do the trick.

curtdbz at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.