我正在尝试在我的网站上创建一个优雅的重置功能,以便当用户按下重置按钮时,输入框淡出用户输入文本,然后淡入占位符文本,准备重新发送文本进入。
$.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)
});
});
以上显示了我想要实现的目标..然而,这会消除整个输入。有人可以请告诉我如何仅对文本实现此效果?
非常感谢,
凸轮。