Results 1 to 4 of 4

Thread: Hints outside Textbox

  1. #1
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Hints outside Textbox

    I want to make a hint when user clicked in textbox. The hint message will display outside the textbox.
    Where can I find related script?
    Or could anyone can help me?

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    You can do this easily with just CSS;
    Code:
    .tip { display:inline-block; position:fixed; z-index:999; padding:0.5em 1em; width:10em; background:yellow; border:1px solid black; opacity:0 }
    .text:focus + .tip { -webkit-animation:fadeIn 1s both; animation:fadeIn 1s both }
    @-webkit-keyframes fadeIn {
    	0% { opacity:0 }
    	100% { opacity:1 }
    	}
    @keyframes fadeIn {
    	0% { opacity:0 }
    	100% { opacity:1 }
    	}
    Code:
    First name: <input type="text" class="text" name="fname"><div class="tip">Please enter your first name here.</div><br/>
    Last name: <input type="text" class="text" name="lname"><div class="tip">Please enter your last name here.</div>
    This will work in IE9+ and modern browsers.

    If you need IE8 support, just use a conditional stylesheet to set .tip as display:none; in it's default state, changing to display:inline-block; on focus.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Sep 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your reply

    I have been tried the above code run at PC which is fine.
    But when I try to run at android web browser. It will occur a problem
    Click image for larger version. 

Name:	Screenshot_2015-02-28-10-00-25.jpg 
Views:	128 
Size:	38.3 KB 
ID:	5600
    The display message is not close

    How can I fixed in?

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    I don't have an Android device to test on at the moment but it works as expected in my tests here on iPhone - the tip boxes vanish as soon as the text field loses focus. At no point do multiple boxes show - only one per focussed form field.

    Please post a link to your page so I can see how you've set it up.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. Replies: 1
    Last Post: 03-18-2014, 02:56 PM
  2. Hints / Help needed for SQL assignment question
    By HELP WITH SQL in forum MySQL and other databases
    Replies: 1
    Last Post: 05-17-2008, 02:25 PM
  3. Replies: 2
    Last Post: 01-16-2008, 09:32 AM
  4. Final Touches Questions Hints...
    By Rockonmetal in forum Other
    Replies: 7
    Last Post: 07-28-2007, 01:48 PM
  5. Replies: 2
    Last Post: 06-10-2007, 08:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •