Created
March 30, 2012 01:26
-
-
Save steveclarke/2245560 to your computer and use it in GitHub Desktop.
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
$ -> | |
# Handle focus on the Contact Form | |
$('#email').focus -> $(this).val('') if $(this).val() == 'E-mail Address' | |
$('#email').blur -> $(this).val('E-mail Address') if $(this).val() == '' | |
$('#phone').focus -> $(this).val('') if $(this).val() == 'Telephone Number' | |
$('#phone').blur -> $(this).val('Telephone Number') if $(this).val() == '' | |
$('#message').focus -> $(this).val('') if $(this).val() == 'Message' | |
$('#message').blur -> $(this).val('Message') if $(this).val() == '' |
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
$(function() { | |
$('#email').focus(function() { | |
if ($(this).val() === 'E-mail Address') { | |
return $(this).val(''); | |
} | |
}); | |
$('#email').blur(function() { | |
if ($(this).val() === '') { | |
return $(this).val('E-mail Address'); | |
} | |
}); | |
$('#phone').focus(function() { | |
if ($(this).val() === 'Telephone Number') { | |
return $(this).val(''); | |
} | |
}); | |
$('#phone').blur(function() { | |
if ($(this).val() === '') { | |
return $(this).val('Telephone Number'); | |
} | |
}); | |
$('#message').focus(function() { | |
if ($(this).val() === 'Message') { | |
return $(this).val(''); | |
} | |
}); | |
$('#message').blur(function() { | |
if ($(this).val() === '') { | |
return $(this).val('Message'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment