I'm trying to create an elegant reset feature on my site such that when the user presses the reset button, the input boxes fade out the user input text and then fade in the placeholder text, ready for text to be re-entered.
$.each($('input.search-box'), function () {
var $input = $(this);
// fade out text - this currently fades the whole element.. which I don't want
$input.animate({ opacity: 0 }, 1000, function () {
// reset to default value
$input.val("");
// fade text back in
$input.animate({ opacity: 1 }, 1000)
});
});
The above shows what I am trying to achieve.. However this fades the whole input out then in. Could someone please tell me how to achieve this effect only on the text?
Many thanks,
Cam.