Last active
August 29, 2015 14:01
-
-
Save tomhodgins/41138c7f7ed9d260071f to your computer and use it in GitHub Desktop.
Display an input's placeholder="" text as a Bootstrap Tooltip on :focus of non-empty form inputs. See this in action at: http://jsfiddle.net/tomhodgins/LEz3Z/2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display placeholder="" text as tooltip for :focused, non-empty inputs | |
$('form input').blur(function() { | |
var inputVal = $(this).val(), | |
titleText = $(this).attr('placeholder'); | |
if ( inputVal != '' ) { | |
$(this).tooltip({ | |
title: titleText, | |
trigger: 'focus', | |
container: 'form' | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment