简体   繁体   English

棘手的Web表单-添加占位符或值

[英]tricky web form - adding placeholder or values

I am working on a little website which has an expanding form in it. 我正在一个小型网站上进行扩展。 I am trying to figure out if its possible, when you click the button which expands the form, whether a default value can appear at that time. 我试图找出是否可能,当您单击展开表格的按钮时,此时是否可以显示默认值。

You can see the theme here: http://themes.premitheme.com/fullscene/ 您可以在此处查看主题: http : //themes.premitheme.com/fullscene/

Click on the Magnifying glass top right and you'll see it expand. 单击右上方的放大镜,您将看到它展开。 I want text to appear in the expanded form, not when its condensed. 我希望文本以展开形式显示,而不是在压缩时显示。 If I put a "placeholder" you see the text in the condensed form and it goes over the magnifying glass icon. 如果我放置“占位符”,您会看到文本的简写形式,并且会越过放大镜图标。 Not pretty. 不漂亮。

Thanks so much! 非常感谢!

在事件处理程序或动画结束回调方法(用于扩展文本框的动画)中,只需设置placeholder属性,然后在/如果未展开搜索框时清除该属性。

The placeholder attribute is perfect for your issue. placeholder属性非常适合您的问题。

You need to find this element. 您需要找到此元素。

<input type="text" class="field" name="s" id="s" >

It should be in search.php ( maybe searchform.php ). 它应该在search.php(可能是searchform.php)中。 Then you want to add your placeholder attribute like this: 然后,您要添加占位符属性,如下所示:

<input type="text" class="field" name="s" id="s" placeholder="your placeholder">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM