Created
June 14, 2012 22:31
-
-
Save fabiancarlos/2933420 to your computer and use it in GitHub Desktop.
Pré mensagens para inputs (jQuery)
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 preMessage(id_input, message_input){ | |
"use strict"; | |
id_input.val(message_input); | |
id_input.focusin(function(){ | |
checkInputFormsNull($(this), message_input); | |
}); | |
id_input.focusout(function(){ | |
checkInputFormsNull($(this), message_input); | |
}); | |
function checkInputFormsNull (input, value) { | |
if (input.val() === '' ) { | |
input.val(value); | |
}else if(input.val() === value){ | |
input.val(""); | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment