Skip to content

Instantly share code, notes, and snippets.

@ribeiroevandro
Created August 17, 2013 12:20
Show Gist options
  • Select an option

  • Save ribeiroevandro/6256658 to your computer and use it in GitHub Desktop.

Select an option

Save ribeiroevandro/6256658 to your computer and use it in GitHub Desktop.
Placeholder com jQuery e HTML5
$(document).ready(function(){
$('.inputs[placeholder]').each(function(){
var ph = $(this).attr('placeholder')
$(this).val(ph).focus(function(){
if($(this).val() == ph) $(this).val('')
}).blur(function(){
if(!$(this).val()) $(this).val(ph)
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment