Forked from clare485/placeholder in input for mailchimp widget
Last active
August 29, 2015 14:03
-
-
Save ejntaylor/2eec685447af618ca6dd to your computer and use it in GitHub Desktop.
This file contains 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
//add placeholder for subscribe form | |
$(".widget_ns_mailchimp input").focus(function(){ | |
showEmptyLabels(); | |
$(this).siblings("label").stop().fadeOut(); | |
}); | |
$(".widget_ns_mailchimp input").blur(function(){ | |
showEmptyLabels(); | |
}); | |
$(".widget_ns_mailchimp label").bind("click", function() { | |
$(this).siblings("div").find("input, textarea").focus(); | |
}); | |
function showEmptyLabels() { | |
$(".widget_ns_mailchimp input").each(function(){ | |
if( $(this).val() == "") { | |
$(this).siblings("label").fadeIn(); | |
} | |
}); | |
} |
This file contains 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
.widget_ns_mailchimp label { | |
position: absolute; | |
margin-top: 8px; | |
margin-left: 10px; | |
display: inline; | |
opacity: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment