我找到了这个Bootstrap Select项目及其Rails的宝石。我想在select标签中实现搜索。
我检查元素,这里是HTML源代码:
<select class="selectpicker" data-live-search="true">
<option>Hot Dog, Fries and a Soda</option>
<option>Burger, Shake and a Smile</option>
<option>Sugar, Spice and all things nice</option>
</select>
如何在表单选择标记中添加data-live-search =“true”?
我的表单选择
<%= f.select :status_cont, [["Activo", "Activo"], ["Inactivo", "Inactivo"]], {:prompt => "Elegir"}, { class: "form-control", 'live-search' => 'true' } %>
但它不起作用 enter image description here
答案 0 :(得分:2)
这应该这样做:
<%= f.select :status_cont, [["Activo", "Activo"], ["Inactivo", "Inactivo"]], {:prompt => "Elegir"}, { class: "form-control", data: { live_search: 'true' } } %>