Last active
August 29, 2015 14:08
-
-
Save adamkudrna/c7d940b17c77c7c3f8ab to your computer and use it in GitHub Desktop.
Insert @ into blank email inputs on focus if empty
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
/** | |
* Insert @ into blank email inputs on focus if empty. | |
*/ | |
$('input[type="email"]').focus(function() { | |
var input = $(this); | |
if (!input.val()) { | |
input.val('@'); | |
} | |
}).blur(function() { | |
var input = $(this); | |
if (input.val() === '@') { | |
input.val(''); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment