Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show UI hints for form controls like the Stack Overflow Career CV form does?

I'm trying to show some UI Hints on an ASP.NET MVC 2 app, much like the way they are displayed on the careers site when you edit/fill out your resume: when a form control has focus, a little description of how to enter the required information appears next to it.

Example #1 http://shog9.com/so_careertip2.png Example #2 http://shog9.com/so_careertip1.png

What is the best method to show these suckers...

like image 417
Hector Minaya Avatar asked Feb 28 '23 00:02

Hector Minaya


1 Answers

Something in the line of:

CSS:

.field{position:relative;}
.field-help{display:none;background:yellow;position:absolute;left:200px;top:0;}

HTML:

<div class="field">
    <input type="text">
    <div class="field-help">Help text</div>
</div>

JQUERY:

$('.field input').bind('focus', function(e) {
    $(e.target).next('.field-help').show();
}).bind('blur', function(e) {
    $(e.target).next('.field-help').hide();
})
like image 185
David Hellsing Avatar answered May 01 '23 08:05

David Hellsing