473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to display default text in a form field that disappears on click?

KeredDrahcir
426 256MB
Is there a way to put some default text in a form field that will disappear when the user focuses on it.
For example you have a login form and it says E-mail in the E-mail box but this disappears as soon as they either click on the box or start typing.

Or is it possible (which is what I really want) to have a drop down list that says --Select One-- before they exapnd it, but when they expand it, that option is availble to be selected?
Nov 22 '10 #1
6 3603
improvcornartist
303 Expert 100+
You should be able use a javascript event to show/hide text in an input field or to add/remove select options as necessary.
Nov 23 '10 #2
drhowarddrfine
7,435 Expert 4TB
The new HTML5 'input' attribute is 'placeholder' which does that for you. It works in all the modern browsers but I don't know recall if it works in IE.

EDIT: Aaaand of course not. Doesn't work in IE.
Nov 23 '10 #3
KeredDrahcir
426 256MB
If it doesn't work in IE it's not much good. I know that IE the nemensis of web developers but the problem is, that most people use it or at least enough to force you to make you websites have to be compatible with it.

Any other options?
Nov 24 '10 #4
drhowarddrfine
7,435 Expert 4TB
Then your only option is javascript. IE always holds back the web.
Nov 24 '10 #5
KeredDrahcir
426 256MB
Javascript's fine. I thought I could do that. How do I hide or change the first option when a user click on it but doesn't hide the first option if they click on it again?
Nov 25 '10 #6
hi,
You can use TextBoxWatermarkExtender of ajax toolkit
Nov 25 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Fuzzyman | last post by:
Sorry if my terminology is wrong..... but I'm having intermittent problems dealing with accented characters in python. (Only from the 8 bit latin-1 character set I think..) I've written an...
3
by: Marti | last post by:
Dear everyone, Its my understanding that IE6 now uses a default text-size of "Small" rather than IE5's "Medium". Since I have used relative font-sizes (usually in ems) on all my sites, I am...
5
by: Vern | last post by:
I'd like the default text to show up in designer, and allow it to be changed to something else. I was able to change some of the other properties, but for some reason I'm having trouble with the...
1
by: Kenneth Keeley | last post by:
Hi, Is it possible to have a dropdown list that when the page is first visited has a selected value of something like "Choose an Option". After the user has selected an option the the user should...
4
by: MasterChief | last post by:
I have an insert template textbox that is bound to a field in SQL. Since it is the insert template it really doesn't have anything in it. How do I set the default text? Like for example if I have a...
2
by: Laphan | last post by:
Hi All Noticed that a lot of sites provide sort of HTML based forms nowadays where you can actually change the text colour and format in the actual text box rather than encapsulate them in tags...
2
by: cashdeskmac | last post by:
Hi, I have create an inherited control (a TextBox which doesn't accept numbers) and have added it to my toolbox. Can anyone give pointers on how to set the Text to "" when an instance of this...
0
by: Esha | last post by:
I'm trying to create a compisite Windows custom control. When I create Inherited control with the name, let's say MyLabel and use Inherits System.Windows.Label, then when I place my control on the...
6
by: aeris | last post by:
Hello, I'm a beginner of using C#. I'm creating a window application, May I know how to clear the default text on textbox when I click directly on the textbox? For example, the txtBox has the...
4
by: aeris | last post by:
Hello! I'm using C# to doing my window application. May I ask, how to write text on textbox after the default text is clear? I have setted the default text in textbox, when a user click on it,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.