<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <link rel="stylesheet" href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css"> <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label class="col-sm-4 control-label">检测时间 <em style="color: red;">*</em></label> <div class="col-sm-4" style="width: 109px;"> <input type="text" value="09:00" class="form-control sleepStart"></input> </div> <div class="col-sm-4" style="width: 109px;"> <input type="text" value="17:30" class="form-control sleepStop"></input> </div> </div> </div> </div> <div id="opts"></div> <div class="row " id="addtimebtn"> <div class="col-md-12 col-sm-12 col-xs-12"> <div id="fat-btn" style="">新增检测时间</div> </div> </div> </body> <script type="text/javascript"> /* 新增检测时间 */ $("#fat-btn") .click( function() { var htm = ""; htm += "<div class='row'>"; htm += "<div class='col-md-12 col-sm-12 col-xs-12'>"; htm += "<div class='form-group'>"; htm += "<label class='col-sm-4 control-label'>检测时间</label>"; htm += "<div class='col-sm-4' style='width: 109px;'>"; htm += "<input type='text' value='09:00' class='form-control sleepStart'></input></div>"; htm += "<div class='col-sm-4' style='width: 109px;'>"; htm += "<input type= 'text' value='17:30' class='form-control sleepStop'></input>"; htm += "</div></div></div></div>"; $('#opts').append(htm); //统计区域时间选择 /*$(".sleepStart").hunterTimePicker(); $(".sleepStop").hunterTimePicker();*/ if ($('.sleepStart').length > 2) { $('#addtimebtn').remove(); } }); </script> </html>