如何在输入框后面插入提示信息?

How to insert hint information right after the input box?

不是真正的问题,但我需要一些问题

是否可以在输入框后面附加 html 值?输入框下方的小文本信息之类的东西

我也做过类似的东西,但不是很漂亮。

f.inputs "Blog" do
  f.input :view_counts, :input_html => { :readonly => true }
  f.input :slug
  li raw("<label class='label'>&nbsp;</label><span class='text-info'>Your Slug will be automatically based on your title or you can choose to enter your own slug title</span>")
  f.input :title
  f.input :content, :as => :ckeditor
  f.input :is_active
  f.input :admin_user_id, as: :hidden, :input_html => { :value => current_admin_user.id }
end

代码在:slug 和:title 之间。你会看到我正在尝试做的事情的草稿。谢谢

您可以添加如下标签:

<label for="slug" class="hint">Your Slug will be automatically based on your title or you can choose to enter your own slug title</label>

然后添加 css 样式如下:

.hint {
    font-weight: normal;
    color: #777;
    font-size: .85em;
}

谢谢你的帮助,我找到方法了。

f.input :slug, hint:"love u"

这将在输入框正下方添加一个小草书文本。