2017-05-31 160 views
0

下面的代碼是我的彈出視圖...我想關閉彈出窗口上點擊關閉按鈕(X)這是在彈出式頂部...在視圖的底部我有jquery關閉popup..but那不是working..i有像父母彈出和兒童的另一個popup..just彈出popup.and在這種情況下,我不得不關閉彈出的孩子......請幫我使用jquery關閉模式彈出框

<div class="modal-dialog" style="width:1056px" id="pop"> 
    <div class="modal-content"> 
     <div class="modal-header">    
      <input type="button" onclick="close()" id="button" value="Close [x]" />   

     </div> 
     <div class="modal-body"> 
      <div class="scroller"> 
       <table class="display table table-striped table-bordered table-hover" id='tblTicket' cellspacing="0" width="100%"> 
        <thead> 
         <tr> 
          <th>Data</th>        
         </tr> 
        </thead> 
        <tbody> 
         <tr> 
          <td>Data</td>        
         </tr> 

        </tbody> 
       </table> 


       <table class="display table table-striped table-bordered table-hover" id='tblTicket' cellspacing="0" width="100%"> 
        <tr> 
         <th>DATA</th>       
        </tr> 

        @foreach (var item in Model) 
        { 
         <tr> 
          <td> 
          data 
          </td>       
         </tr> 
        } 

       </table> 
      </div> 
     </div> 
    </div> 
</div> 

<script type="text/javascript" language="javascript"> 
$("#button").click(function() {   
    $("#pop").close 
     }); 
</script> 
+0

[關閉引導模態(的可能的複製https://stackoverflow.com/questions/16493280/close-bootstrap-modal ) – Curiousdev

回答

0

嘗試這

<script type="text/javascript" language="javascript"> 
$("#button").click(function() {   
    $('#pop').modal('hide'); 
     }); 
</script> 
+0

所有3個解決方案不工作在我的情況 –

0

請檢查下面的代碼:

<script type="text/javascript" language="javascript"> 

    $("#button").click(function() { 
     $('#pop').modal('toggle'); 
     $('#pop').modal('hide'); 
     $('.modal-backdrop').removeClass('modal-backdrop'); 
     $('.fade').removeClass('fade'); 
     $('.in').removeClass('in'); 

     $('html, body').css({ 
      'overflow': 'auto', 
      'height': 'auto' 
     }); 

    }); 

</script> 

乾杯!

1

試試這個代碼: -

$("#button").click(function() { 

    $('#pop').modal('toggle'); 

}); 

+0

您的代碼正在工作......但多數民衆贊成工作後點擊兩次...兄弟的問題是,我有兩個彈出...所以「模態」可能會在這個衝突case –

+0

@sachinsingh c你創建一個片段,以便我可以編輯它:) – mayank

+0

你有兩個彈出相同的ID? – mayank