开发者

Fading form values with jQuery

开发者 https://www.devze.com 2022-12-20 13:59 出处:网络
Is there any way to fade out the set value of a field on fo开发者_如何学Pythoncus, and then fade it back in on blur if nothing was entered?

Is there any way to fade out the set value of a field on fo开发者_如何学Pythoncus, and then fade it back in on blur if nothing was entered?

I'd like to fade out "Enter your name..." on focus, but fade it back in on blur if the user didn't enter anything.

Thanks!


Try the jQuery labelify plugin: http://www.kryogenix.org/code/browser/labelify/

I think it's exactly what you're looking for.


I'd check out the labelOver plug-in for this. Very lightweight and does a field mask like you're talking about...I'm using it currently as tip text for search fields.

For a quick look: Demo Here


There are a lot of Watermark plugins out there for jQuery. One of them should do the job, I'd imagine


I have been using a plugin for this - and it has worked quite well.

///http://code.google.com/p/jquery-watermark/
/// Adds the watermark to the text entry areas
var watermarkText = '<type>';
$(function()
{
    $('.cptEntryArea').watermark(watermarkText);
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号