2014-06-06 40 views

回答

1

通過爲組中的單選按鈕指定相同的name屬性來創建單選按鈕組。簡單地給另一個共同的name第二行的單選按鈕,以便他們將作爲一個不同的組...

+0

但是將來可能會很長。因爲它會動態生成。所以這不會是理想的解決方案 –

+0

那麼,你必須通過一些數據循環來創建這些......使用循環的索引來產生公共組......或者爲** future **場景提供一個小規模的例子,這樣我們可以拿出一些相關的東西.. –

+0

@ user2043331你可以使用'index'就像:每次你創建一個組只需要'i ++'。 –

0

如果您使用循環來創建這些單選按鈕,使用索引(作爲前綴)單選按鈕名稱。

像:

<input type="radio" name="first_1"> 
<input type="radio" name="first_2"> 

1和2是這裏的指標..

0

您可以選擇單選按鈕多於一個選項,但不要把單選按鈕的名稱相同的其他按鈕,每個按鈕應該有獨特的名字。 這樣

<input type="radio" name="button1"> 
    <input type="radio" name="button2"> 

還訪問您的link我已經改變了它

1

單選按鈕活動依賴於名字。如果你想要一組Radibuttons,只需命名該組。

<input type="radio" name="optionsRadios" class="optionsRadios2" value="option1" checked="checked" title="Nenhum"> 
{...} 

<input type="radio" name="optionsRadios2" class="optionsRadios2" value="option1" checked="checked" title="Nenhum"> 
0

你需要給每個單選按鈕的「設置」不同的名稱:

<div class="icon-thread"> 
    <ul> 
     <li> 
      <input type="radio" name="optionsRadios_set1" class="optionsRadios2" value="option1" checked="checked" title="Nenhum"> 
      <label class="radio" for="optionsRadios2"><i class="icon-ban-circle icon-stack-base text-error"></i></label> 
     </li> 
     <li> 
      <input type="radio" name="optionsRadios_set1" class="optionsRadios2" value="option2"> 
      <label class="radio" for="optionsRadios2"><i class="icon-fixed-width icon-moon"></i></label> 
     </li> 
     <li> 
      <input type="radio" name="optionsRadios_set1" class="optionsRadios2" value="option3"> 
      <label class="radio" for="optionsRadios2"><i class="icon-fixed-width icon-plane"></i></label> 
     </li> 
    </ul> 
</div> 
<div class="icon-thread"> 
    <ul> 
     <li> 
      <input type="radio" name="optionsRadios_set2" class="optionsRadios2" value="option1" checked="checked" title="Nenhum"> 
      <label class="radio" for="optionsRadios2"><i class="icon-ban-circle icon-stack-base text-error"></i></label> 
     </li> 
     <li> 
      <input type="radio" name="optionsRadios_set2" class="optionsRadios2" value="option2"> 
      <label class="radio" for="optionsRadios2"><i class="icon-fixed-width icon-moon"></i></label> 
     </li> 
     <li> 
      <input type="radio" name="optionsRadios_set2" class="optionsRadios2" value="option3"> 
      <label class="radio" for="optionsRadios2"><i class="icon-fixed-width icon-plane"></i></label> 
     </li> 
    </ul> 
</div> 

編輯:順便說一句,你已經被濫用的標籤for屬性。這應該匹配input元素的id

相關問題