Skip to content

Instantly share code, notes, and snippets.

@vanchelo
Forked from anonymous/hint.js
Last active December 20, 2015 13:09
Show Gist options
  • Save vanchelo/6136905 to your computer and use it in GitHub Desktop.
Save vanchelo/6136905 to your computer and use it in GitHub Desktop.
/*DISPLAY HINTS FOR INPUTS*/
$('input').on('focus', function() {
var hint = $(this).attr('hint');
if(hint !== undefined){
$(this).after('<div class="hint">'+hint+'</div>');
$('.hint').fadeIn('fast');
$(this).closest('.row').find('label.error').hide();
}
})
$('input').on('blur',function(){
$(this).closest('.row').find('.hint').fadeOut('fast', function() {
$(this).remove();
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment