2013-06-04 75 views
1

我正在嘗試使用Rails 4在jQuery移動窗體中內聯顯示單選按鈕。單選按鈕標籤沒有像其他輸入字段標籤一樣格式化,並且按鈕顯示在單獨的行上。我怎樣才能在一行顯示標籤和按鈕。這些按鈕也是頁面的整個寬度,而不僅僅是寬度足以容納標籤。內嵌顯示單選按鈕

<div> 
    <%= f.label :boss %> 
    <%= f.radio_button :boss, false %> 
    <%= f.label :boss, 'No', :value => false %> 
    <%= f.radio_button :boss, true %> 
    <%= f.label :boss, 'Yes', :value => true %> 
</div> 

回答

1

您必須將它們包裝成有一個屬性data-tape="horizontal"一個字段:

<fieldset data-role="controlgroup" data-type="horizontal"> 
    <legend>Horizontal:</legend> 
    <input name="radio-choice-h-2" id="radio-choice-h-2a" value="on" checked="checked" type="radio"> 
    <label for="radio-choice-h-2a">One</label> 
    <input name="radio-choice-h-2" id="radio-choice-h-2b" value="off" type="radio"> 
    <label for="radio-choice-h-2b">Two</label> 
    <input name="radio-choice-h-2" id="radio-choice-h-2c" value="other" type="radio"> 
    <label for="radio-choice-h-2c">Three</label> 
</fieldset> 

工作例如:http://jsfiddle.net/Gajotres/e4cWr/