当我点击div标签中的按钮时为什么数据会反映出来?

时间:2018-01-04 14:41:22

标签: javascript html css bootstrap-4

我用模态设计了表格。当我点击符号按钮时,模式会弹出表格中的第一行数据反映,就像数据阴影一样。我对关闭div很困惑。我想我错放了div end标签。 模态工作正常。模态正常运行

<style>
.modal-body {
    max-height: calc(100vh - 210px);
    overflow-y: auto;
}

</style>

   
    
        
        
            <div class="row">
                
            <div class="panel panel-default">
                       
            <div class="panel-body pn">                            

            <div style="overflow-x:auto;">
             <br>
            <div class="table-responsive mbn">         
            <table class="table table-bordered mbn">
            <div class="panel-heading">
            <span class="panel-title">
            <span class="fa fa-table"></span><font color="red">ex</font></span>
            
            </div>
 
    <tr>
      <th><font color="red" size="2">Ref</font></th>
      <th><font color="red" size="2">Da</font></th>
     
	   <th><font color="red" size="2">sined</font></th>
	 
   		   
     		 <tr>			
			<td>></td>
			<td></td>
			 Details </a></td>
			<td> EDIT </a></td>	
		    
		    <td><button class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">sign</button></td>
			</tr>


 		 </table>
   </div>
   			
             

 		<div id="myModal" class="modal fade">
    		<div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">List s</h4>
            </div>
            <div class="modal-body">
            
              <div class="table-responsive mbn">         
            <table class="table table-bordered mbn">
 
    <tr>
      <th width="70"><font color="red" size="2">Sl</font></th>
      <th><font color="red" size="2">Name</font></th>
     <th width="90"><font color="red" size="2"></font></th>
     
      </tr>
      
      <tr>
      <td>1</td>
			<td>I</td>
   <td> <input type="checkbox" name="assign" value="Bike"></td>
			
      </tr>
      
      </table>
     
     
            
           
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-info">Submit</button>
            </div>
             
             	    
            </div>
            </div>
            </div>
            </div>
		  
          

            
        <!-- /.modal-content -->
					
         
		
		</div>
        </div>
	    </div>
	    </div>
        </div>
        

请帮助

1 个答案:

答案 0 :(得分:0)

您的A标签和丢失的TD标签不匹配。在这里它被清理和工作: https://jsfiddle.net/DTcHh/41416/

<style>
    .modal-body {
        max-height: calc(100vh - 210px);
        overflow-y: auto;
    }
</style>




<div class="row">

    <div class="panel panel-default">

        <div class="panel-body pn">

            <div style="overflow-x:auto;">
                <br>
                <div class="table-responsive mbn">
                    <div class="panel-heading">
                        <span class="panel-title">
                            <span class="fa fa-table"></span><font color="red">ex</font>
                        </span>

                    </div>
                    <table class="table table-bordered mbn">


                        <tr>
                            <th><font color="red" size="2">Ref</font></th>
                            <th><font color="red" size="2">Da</font></th>

                            <th><font color="red" size="2">sined</font></th>


                        <tr>
                            <td></td>
                            <td></td>
                            <td><a>Details </a></td>
                            <td> <a>EDIT </a></td>

                            <td><button class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">sign</button></td>
                        </tr>


                    </table>
                </div>



                <div id="myModal" class="modal fade">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <h4 class="modal-title">List s</h4>
                            </div>
                            <div class="modal-body">

                                <div class="table-responsive mbn">
                                    <table class="table table-bordered mbn">

                                        <tr>
                                            <th width="70"><font color="red" size="2">Sl</font></th>
                                            <th><font color="red" size="2">Name</font></th>
                                            <th width="90"><font color="red" size="2"></font></th>

                                        </tr>

                                        <tr>
                                            <td>1</td>
                                            <td>I</td>
                                            <td> <input type="checkbox" name="assign" value="Bike"></td>

                                        </tr>

                                    </table>




                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                                        <button type="button" class="btn btn-info">Submit</button>
                                    </div>


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




                    <!-- /.modal-content -->



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