HTML5 和placeholder:如何逐步进行?
我正在考虑使用 HTML5 的 placeholder
属性。如果浏览器不支持 HTML5,我可以使用 jQuery 作为后备。但是,如果JS关闭了怎么办?我如何使用渐进增强理念来处理这个问题?
I'm thinking about using HTML5's placeholder
attribute. If the browser doesn't support HTML5, I can use jQuery as a fallback. However, what if JS is turned off? How do I handle this using the progressive enhancement philosophy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不显示实际的
元素并用 js 隐藏它?
这样,没有 js,他们就会看到常规标签;使用 js,标签将被删除,您将获得 jquery 占位符或 html5 占位符。
Why don't you show an actual
<label>
element and hide it with js?That way, without js, they'll see a regular label; with js, the label will be removed and you'll get either your jquery placeholder, or your html5 placeholder.