Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ejntaylor/2eec685447af618ca6dd to your computer and use it in GitHub Desktop.
Save ejntaylor/2eec685447af618ca6dd to your computer and use it in GitHub Desktop.
//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();
}
});
}
.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