本文介绍了JQuery空文本框上的默认文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个电子邮件表单文本框,虽然它是空的,但我希望它具有电子邮件的值,而当您点击它时,文本消失。如果有人点击它并且不输入文字。在模糊我想它会返回到默认文本。
我一直在尝试几件事情,但没有任何工作。有人能指点我的方向吗?
b$ b
< input type =textid =keywordname =keywordplaceholder =在此输入关键字/>
I have a email form text box that while it is empty I would like it to have the value "E-Mail" And when you click on it the text goes away. If someone clicks on it and doesn't enter text. on Blur I would like for it to return to having the default text.
I have been trying a few things but nothing is working. Could someone please point me in the right direction?
解决方案
Or you could just use the placeholder html5 attribute:
<input type="text" id="keyword" name="keyword" placeholder="Type keyword here" />
这篇关于JQuery空文本框上的默认文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!