将collection_select显示为图像(Rails 3应用)

时间:2022-08-14 21:52:17

All,

所有人,

BACKGROUND: I have a collection_select statement that displays a dropdown box.

背景:我有一个显示下拉框的collection_select语句。

OBJECTIVE: I'd like the dropdown to be an image that the user clicks to see the collection rather than the default box + down arrow that appears.

目标:我希望下拉菜单是用户单击以查看集合的图像,而不是出现的默认框+向下箭头。

1 个解决方案

#1


1  

You need something like this plugin for jQuery. It allows you to replace a normal select with a custom one based on your wants. You would have to write your own select helper since you need to add the attributes to the select options that this plugin requires. If you get started and need help, post back here with what you're stuck on.

jQuery需要类似的插件。它允许您根据需要用自定义的选择替换普通的选择。您需要编写自己的select helper,因为您需要将属性添加到这个插件所需要的选择选项中。如果你开始需要帮助,把你困在这里的东西贴回来。

#1


1  

You need something like this plugin for jQuery. It allows you to replace a normal select with a custom one based on your wants. You would have to write your own select helper since you need to add the attributes to the select options that this plugin requires. If you get started and need help, post back here with what you're stuck on.

jQuery需要类似的插件。它允许您根据需要用自定义的选择替换普通的选择。您需要编写自己的select helper,因为您需要将属性添加到这个插件所需要的选择选项中。如果你开始需要帮助,把你困在这里的东西贴回来。