Skip to content

Instantly share code, notes, and snippets.

@anneallen
Created November 11, 2013 21:08
Show Gist options
  • Save anneallen/7420354 to your computer and use it in GitHub Desktop.
Save anneallen/7420354 to your computer and use it in GitHub Desktop.
Add Placeholder text to wordpress login forms
// JavaScript Document
jQuery(function ($) {
/* You can safely use $ in this code block to reference jQuery */
$(document).ready(function(){
$('form').find('input[name="log"]').each(function(ev)
{
if(!$(this).val()) {
$(this).attr("placeholder", "Username");
}
});
});
$(document).ready(function(){
$('form').find('input[name="pwd"]').each(function(ev)
{
if(!$(this).val()) {
$(this).attr("placeholder", "Password");
}
});
});
/* You can safely use $ in this code block to reference jQuery */
});
@emilushi
Copy link

emilushi commented Jun 3, 2016

What about localize support? I think you have to use wp_localize_script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment