0
我想在導軌中以簡單形式使用我的自定義按鈕作爲單選按鈕。但我真的不知道該怎麼做。我有一個CSS代碼,給我我想要的按鈕,但我認爲我的簡單形式是錯誤的,我真的不知道如何設置javascrip ...Rails:simple_form單選按鈕
有人知道我怎麼能得到這個權利?
我的簡單形式:
<%= simple_form_for(@post, :html => {:class => 'form-inline' }) do |f| %>
<%= f.input :link, label: false %>
<div class="button_group">
<%= f.input :type, as: :hidden %>
<a class="radio_button" data-value="0">ONE</a>
<a class="radio_button" data-value="1">TWO</a>
<a class="radio_button" data-value="2">THREE</a>
</div>
<%= button_tag(type: 'submit', class: "submit_button") do %>
SUBMIT!
<% end %>
<% end %>
CSS按鈕:
.radio_button {
color: white;
background-color:#828282;
font-family: 'Fjalla One', serif;
font-size: 10pt;
font-weight: 100;
text-align: center;
font-style: italic;
padding:0px 6px;
padding-right: 8px;
padding-top: 3px;
padding-bottom: 2px;
text-decoration:none;
border: none;
}.radio_button:hover {
background-color:#0E9EBB;
color: white;
text-decoration:none;
}.radio_button:active {
position:relative;
background-color:#0E9EBB;
top:1px;
}
謝謝,它工作:)但爲什麼'#post_type'? – allegutta
看更新..... – juanpastas
啊,我明白了。再次感謝 :) – allegutta