2015-10-10 33 views
1

問題我已經創建了兩個單選按鈕,使用沒有JavaScript的引導程序。 當我試圖查看並單擊單選按鈕時。我選擇他們都引導多個單選按鈕選擇

這是我的html代碼與單選按鈕。我將不勝感激任何可以解決我的問題的建議。謝謝你們

<div class="col-md-2"> 
    <form role="form"> 
     <div class="table table-responsive"> 
      <table class="table"> 
       <tr class="active"> 
        <th> 
         <div class="radio"> 
         <label><input type="radio" name="one-way" >One way</label> 
         </div> 
        </th> 
        <th> 
         <div class="radio"> 
         <label><input type="radio" name="roundtrip">Roundtrip</label> 
         </div> 
        </th> 
       </tr> 
       <tr> 
        <td colspan="2"> 
         <label for="start-location">From (Any City or Airport)</label> 
        </td> 
       </tr> 
       <tr> 
        <td colspan="2"> 
         <select class="form-control" id="start-location"> 
          <option class="default"></option> 
          <option>Manila</option> 
          <option>Cebu</option> 
          <option>Cagayan</option> 
          <option>Davao</option> 
          <option>General Santos</option> 
         </select> 
        </td> 
       </tr> 
       <tr> 
        <td colspan="2"> 
         <label for="target-location">To (Any City or Airport)</label> 
        </td> 
       </tr> 
       <tr> 
        <td colspan="2"> 
         <select class="form-control" id="target-location"> 
          <option class="default"></option> 
          <option>Manila</option> 
          <option>Cebu</option> 
          <option>Cagayan</option> 
          <option>Davao</option> 
          <option>General Santos</option> 
         </select> 
        </td> 
       </tr> 
      </table> 
     </div> 
    </form> 
</div> 

圖片是在這裏: enter image description here

+1

具有相同名稱的單選按鈕被視爲一個組。名稱是不同的,所以你可以選擇 –

+0

哦,我現在得到它。謝謝 –

回答

1

如果單選按鈕確實代表一種選擇,你想只有兩個中的一個被選中,你必須給他們喜歡同一個名字:

<div class="col-md-2"> 
    <form role="form"> 
    <div class="table table-responsive"> 
    <table class="table"> 
    <tr class="active"> 
     <th> 
     <div class="radio"> 
      <label> 
      <input type="radio" name="roundtrip">One way</label> 
     </div> 
     </th> 
     <th> 
     <div class="radio"> 
      <label> 
      <input type="radio" name="roundtrip">Roundtrip</label> 
     </div> 
     </th> 
    </tr> 
    <tr> 
     <td colspan="2"> 
     <label for="start-location">From (Any City or Airport)</label> 
     </td> 
    </tr> 
    <tr> 
     <td colspan="2"> 
     <select class="form-control" id="start-location"> 
      <option class="default"></option> 
      <option>Manila</option> 
      <option>Cebu</option> 
      <option>Cagayan</option> 
      <option>Davao</option> 
      <option>General Santos</option> 
     </select> 
     </td> 
    </tr> 
    <tr> 
     <td colspan="2"> 
     <label for="target-location">To (Any City or Airport)</label> 
     </td> 
    </tr> 
    <tr> 
     <td colspan="2"> 
     <select class="form-control" id="target-location"> 
      <option class="default"></option> 
      <option>Manila</option> 
      <option>Cebu</option> 
      <option>Cagayan</option> 
      <option>Davao</option> 
      <option>General Santos</option> 
     </select> 
     </td> 
    </tr> 
    </table> 
</div> 

這應該解決您的問題。

注意單選按鈕名稱的更改