jquery - icloud.com 喜欢表单输入字段

标签 jquery css forms input

如何制作一个像在 iCloud 上看到的输入字段?

我希望占位符一直保留到有人开始输入为止。有没有办法用 jQuery 来完成这个?

最佳答案

您可能指的是水印功能。

A watermark typically appears as light gray text within an input or textarea element whenever the element is empty and does not have focus. This provides a hint to the user as to what the input or textarea element is used for, or the type of input that is required.

watermark
(来源:googlecode.com)

如果是这种情况,您可能想尝试 jquery-watermark 。它支持HTML5 "placeholder" native 功能(在支持它的浏览器中)并在其他/旧版本中优雅地降级。

注意:存在许多其他插件。 Googling 'jquery watermark''jquery placeholder'将帮助您找到它们:)

注意 2:为了尽可能兼容,Apple 依赖 HTML5 占位符属性,而只是利用 JQuery 在用户开始输入。

关于jquery - icloud.com 喜欢表单输入字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8880090/

相关文章:

PHP 表单未将图像提交到 MySQL 表中

php - 用于将多个值插入 HTML 表单上的单独行的数据库设计

jquery - 在 jquery 中更改 css 背景颜色

javascript - jquery 删除不适用于响应文本

html - 使两个元素等高,一个带有垂直滚动条

javascript - 尝试附加带有日期戳的 css/js 文件的路径

javascript - 在切换按钮单击时更改变量的值

javascript - html 表 tr onkeydown 不工作

jquery - Bootstrap 轮播在页面加载后插入时不起作用

javascript - 提交后表单成功消息消失