【问题标题】:How do I add a img to a select tag?如何将 img 添加到选择标签?
【发布时间】:2016-01-10 19:20:07
【问题描述】:

我想在 ruby​​ 中将图像添加到以下行。

我的选择标签如下

<%= select_tag :type, options_for_select(['All'] | shop.types.map{|o| [o, o.downcase] }),class: 'hometest' %>

这是我希望放置在其中的类的图像。

<%= image_tag 'dropdown.svg', class: "dropdownimg" %>

【问题讨论】:

    标签: html ruby-on-rails html-select


    【解决方案1】:

    Rails 中的 select_tag 只使用原生 HTML <select>: http://www.w3schools.com/tags/tag_select.asp

    在此标签中不能使用除文本以外的任何内容。

    请参阅此 SO 帖子了解一些可能适合您的选项:How to render images in rails3 select

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-19
      • 1970-01-01
      • 2019-06-10
      • 2019-01-07
      • 1970-01-01
      • 2023-03-22
      • 2023-04-03
      • 2022-01-14
      相关资源
      最近更新 更多