2017-05-31 157 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