如何向 text_field_tag 添加占位符? [英] How to add a placeholder to a text_field_tag?
本文介绍了如何向 text_field_tag 添加占位符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表单中有以下行:
= text_field_tag :mother_name, nil, id: 'mother_name_autocomplete', class: 'form-group form-control', autocomplete: 'off', data: {provide: 'typeahead'}
如何向该字段添加占位符?
How can I add a placehodler to this field?
推荐答案
如果你正在使用 text_field_tag
那么你可以做这样的事情.
if you are using text_field_tag
then you can do something like this.
<%= text_field_tag :mother_name, nil, placeholder: 'Some text' %>
注意第二个参数是nil
.
这篇关于如何向 text_field_tag 添加占位符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文