带有占位符文本的文本框,逐字逐句消失 [英] text box with placeholder text that dissapears character by character
问题描述
我正在寻找一种方法来构建一个带有占位符文本的文本框,用于日期字段。占位符文本将是xx / xx / xxxx并逐个字符消失,并在用户键入时留下斜杠。我遇到了以下两个问题,它们似乎解决了使文本一下子消失的问题。
I am looking for a way to structure a textbox with placeholder text for a date field. The placeholder text would be xx/xx/xxxx and disappear character by character leaving the slashes in place as the user types. I came across the following two questions which seem to solve the problem of making the text disappear all at once.
HTML / CSS制作一个带有灰色文字的文本框,当我点击输入信息时会消失,怎么样?
如何预先填充输入文本字段,提示文本在输入时消失(jQuery)
我想知道是否有一个javascript技巧或可以实现此目的。
I am wondering if maybe there is a javascript trick or something that could accomplish this.
推荐答案
您正在寻找这个令人敬畏的文本输入掩码插件!
You are looking for this awesome text input mask plugin!
http://digitalbush.com/projects/masked-input-plugin/
你没有在你的问题中提到任何限制,所以我认为jQuery解决方案没问题。
You didn't really mention any restraints in your question so I assumed a jQuery solution would be fine.
这篇关于带有占位符文本的文本框,逐字逐句消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!