2017-01-13 131 views
0
<div class="continer"> 
        <div class="row"> 
         <div class="col-md-2"> 
          <button class="btn btn-primary" target="#loginmodal" data-toggle="modal"></button> 
          <div class="modal" id="loginmodal" tabindex="-1"> 
           <div class="modal-dialog"> 
            <div class="modal-content"> 
             <div class="modal-header"> 
              <button class="close" data-dismiss="modal">&times;</button> 
             </div> 
             <div class="modal-body"> 
              <form> 
               <div class="form-group"> 
                <label for="Username">Username</label> 
                <input type="text" name="text" class="form-control"> 
               </div> 
               <div class="form-group"> 
                <label for="Password">Password</label> 
                <input type="Password" name="text" class="form-control"> 
               </div> 
              </form> 
             </div> 
             <div class="modal-footer"> 
              <button class="btn btn-primary" data-dismiss="modal">Close</button> 
             </div> 
            </div> 
           </div> 
          </div> 
         </div> 
        </div> 
       </div> 

我已經寫了登錄模式的boostrap代碼,但它不工作我已經嘗試了所有從myside但不知道是什麼原因。Bootstrap模式沒有顯示

我添加了以下鏈接

回答

1

target屬性應該是data-target在觸發模式顯示的按鈕。我還要添加type="button"到這個按鈕:

<div class="continer"> 
    <div class="row"> 
     <div class="col-md-2"> 
      <button type="button" class="btn btn-primary" data-target="#loginmodal" data-toggle="modal">Launch Modal</button> 
      <div class="modal" id="loginmodal" tabindex="-1" role="dialog"> 
       <div class="modal-dialog" role="document"> 
        <div class="modal-content"> 
         <div class="modal-header"> 
          <button class="close" data-dismiss="modal">&times;</button> 
         </div> 
         <div class="modal-body"> 
          <form> 
           <div class="form-group"> 
            <label for="Username">Username</label> 
            <input type="text" name="text" class="form-control"> 
           </div> 
           <div class="form-group"> 
            <label for="Password">Password</label> 
            <input type="Password" name="text" class="form-control"> 
           </div> 
          </form> 
         </div> 
         <div class="modal-footer"> 
          <button class="btn btn-primary" data-dismiss="modal">Close</button> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
+0

thanxxxxx它現在工作。屬性存在問題。 – John

+0

很高興幫助:)。請標記幫助您解決此問題的答案。 –