如何将占位符添加到GWT文本输入字段 [英] How to add a placeholder to a GWT text input field

查看:94
本文介绍了如何将占位符添加到GWT文本输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人知道Google Web Toolkit文本输入小部件在空白时会在字段中显示消息?

例如,第一个名字字段,会说:'输入你的名字',当用户开始输入时,标签将被删除,以显示输入的文本。



你会怎么做这是吗?



Daniel

解决方案

textarea:

  yourInputField.getElement()。setPropertyString(placeholder,输入你的名字); 

我认为这是一项HTML5功能。

Does any know of a Google Web Toolkit text input widget that would display a message inside the field when it is empty?

E.g. a first name field that would say: 'enter your first name' and when the user starts typing the label is removed to show the typed text.

How would you go about this?

Daniel

解决方案

This does the work for me in a textarea:

yourInputField.getElement().setPropertyString("placeholder", "enter your first name");

I think it is a HTML5 feature.

这篇关于如何将占位符添加到GWT文本输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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