Fade In and / or Out Placeholder Text
问题 Is there a way to fade in and out an input's placeholder text? I've tried: $('.userBox::-webkit-input-placeholder').animate({color: '#888888'}, 500); But this just crashes... 回答1: If you want to fade out on focus, and fade back in on blur ( when the input box is empty ), the following should work in webkit: HTML: <input id="user_email" name="user[email]" placeholder="user@example.org" type="email" /> CSS: input[type="email"]::-webkit-input-placeholder { -webkit-transition: opacity 0.3s linear