Click here to Skip to main content
13,554,130 members
Rate this:
Please Sign up or sign in to vote.
See more:
How to add a text value in text box in html and javascript. when you load the website; the textbox has to show the sample value "Enter Your Name Here", when the user hit the textbox, it has clear the "Enter Your Name Here" value automatically. i am developing my website using HTML and Javascript. can any one help out please?
Thanks in advance.
Posted 18-Jan-13 6:43am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You set the value attribute of the input tag to the value you want.

e.g. <input value="something" />

See this page:[^]

If you are just starting out; visit here:[^]
lisalis 18-Jan-13 13:01pm
if i enter the value like this; it is not working
<input type="text" value="Enter APN or Address here" name="identifytext" id="identifytext" class="text ui-widget-content ui-corner-all" style="color:#2E6E9E;width:220px;height:25px;z-index:500"></input>
lisalis 18-Jan-13 13:05pm
Thank you so much for your help. It is working.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Davids solution is going to get you on the right path.
Here is an example of using jQuery to accomplish this along with an article that explains the code.[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03-2016 | 2.8.180515.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100