gpt4 book ai didi

ruby-on-rails - 在 Rails 中创建多个链接的下拉列表

转载 作者:行者123 更新时间:2023-12-03 01:15:41 27 4
gpt4 key购买 nike

我有很多链接,例如 link1、link2、link3、link4 ...link9。我必须在下拉列表中添加这些链接。我尝试使用 Rails select_tag 和 html 标签

使用 html 选择标签

<span class="device_update">
<select>
<option value="link1"><%= link_to "link1", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></option>
<option value="link2"><%= link_to "link2", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></option>
<option value="link3"><%= link_to "link3", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></option>
......

<option value="link9"><%= link_to "link9", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></option>
</select>
</span>

如何制作多个链接的下拉列表

最佳答案

我通过以下方式做到了这一点。为此我引用bootstrap button dropdowns

<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><%= link_to "link1", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></li>
<li><%= link_to "link1", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></li>
<li><%= link_to "link3", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></li>
<li class="divider"></li>
<li><%= link_to "link4", "#",{:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal-window'} %></li>
</ul>
</div>

关于ruby-on-rails - 在 Rails 中创建多个链接的下拉列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23708852/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com