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

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

问题描述

适用于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 />

但是,它不能在Firefox的3.5及更早版本中工作,显然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插件,是SOOO不错。

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中的占位符旁边。

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

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

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