如何在不支持 html5 标签选项的 firefox 和其他浏览器中获取占位符文本? [英] How do I get placeholder text in firefox and other browsers that don't support the html5 tag option?

查看:27
本文介绍了如何在不支持 html5 标签选项的 firefox 和其他浏览器中获取占位符文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这适用于 Chrome 和任何其他支持 HTML5 中的占位符文本的浏览器

This works in Chrome and any other browser that supports placeholder text in HTML5

<input id="name" name="name"  type="text" placeholder="Please enter your name..." required /> <br />

但是,它在 3.5 及更早版本的 Firefox 中不起作用,显然在 IE8 以及其他可能的浏览器中不起作用.

But, it doesn't work in 3.5 and earlier of Firefox, and obviously IE8, and possibly other browsers.

我如何实现同样的事情(最好在 HTML/CSS 中 - 如果不是,我愿意接受建议),以支持所有旧浏览器?如果不是每个浏览器,至少是 Firefox 和 IE.

How do I achieve the same thing (preferably in HTML/CSS - if not I am open to suggestions), to support all the older browsers? If not every single browser, at least Firefox and IE.

Safari 和 Chrome 已经支持它(或最新版本).

Safari and Chrome already support it (or the latest versions anyway).

谢谢.

推荐答案

顺便说一句...如果有人感兴趣...我找到了一个很好的优雅解决方案,它是一个非常好的 jQuery 插件.

By the way...if anyone is interested...I found a nice elegant solution that is a jQuery plugin that is SOOO nice.

它实际上是一行 jQuery,一个缩小的 js 插件,以及一个简单的输入类名.

It literally is one line of jQuery, a minified js plugin, along with a simple class name on the input.

http://labs.thesedays.com/projects/jquery/clearfield/

这是我发现的最漂亮的东西,在 html 中的Placeholder"旁边.

It's the most beautiful thing I have discovered, next to 'Placeholder' in html.

这篇关于如何在不支持 html5 标签选项的 firefox 和其他浏览器中获取占位符文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆