I made this simple function to add placeholder in browsers that do not support it:
DEMO
The question is: How can I add to that function the possibility to remove the placeholder when the user click inside it?
Try to use removeAttr() like,
$('input,textarea').focus(function(){
$(this).removeAttr('placeholder');
});
Demo
To get the placeholder value
again on blur()
try this,
$('input,textarea').focus(function(){
$(this).data('placeholder',$(this).attr('placeholder'))
.attr('placeholder','');
}).blur(function(){
$(this).attr('placeholder',$(this).data('placeholder'));
});
Demo 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With