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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KeredDrahcir
    Contributor
    • Nov 2009
    • 426

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

    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?
  • improvcornartist
    Recognized Expert Contributor
    • May 2007
    • 303

    #2
    You should be able use a javascript event to show/hide text in an input field or to add/remove select options as necessary.

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      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.

      Comment

      • KeredDrahcir
        Contributor
        • Nov 2009
        • 426

        #4
        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?

        Comment

        • drhowarddrfine
          Recognized Expert Expert
          • Sep 2006
          • 7434

          #5
          Then your only option is javascript. IE always holds back the web.

          Comment

          • KeredDrahcir
            Contributor
            • Nov 2009
            • 426

            #6
            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?

            Comment

            • kiranghadge
              New Member
              • May 2010
              • 9

              #7
              hi,
              You can use TextBoxWatermar kExtender of ajax toolkit

              Comment

              Working...