Textarea占位符不起作用 [英] Textarea Placeholder is not working

查看:55
本文介绍了Textarea占位符不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了下面的textarea代码,但占位符不起作用.我在文本框上看不到占位符.

I have written the below textarea code and the placeholder is not working. I can't see the placeholder on the textarea box.

<textarea rows="4" cols="50" placeholder="Current Address">
</textarea>

推荐答案

不要在开始标记和结束标记< textarea></textarea>

don't keep gap between start and end tag <textarea></textarea>

使用此:

<textarea rows="4" cols="50" placeholder="Current Address"></textarea>

W3School示例

之所以可行,是因为在 textarea 标记之间的换行符被视为内容,因此将其放置在框内而不是占位符.

The reason that this works is because the newline character in between the textarea tags is considered content, so it is placed inside the box instead of the placeholder.

这篇关于Textarea占位符不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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