javascript - To hide the div on ajax call if I get result -
here, getting result through ajax. want hide div if result ajax. below div want hide if result through ajax.
here code,
$("button").click(function(){     var dateselect=$("#dateselect").val();     var userselect = $("#employee").val();      $.ajax({         type: 'get',         url: "<?php base_url() ?>manage_attendance/listing",         data:'dateselect='+dateselect+'&userselect='+userselect,         datatype: "json",         success: function(data) {                                     $('.clkin_time').html(data.result);                    if(data.clkout_result != "0000-00-00 00:00:00") {                        $('.clkout_time').html(data.clkout_result);                          //document.getelementbyid('selecttime').style.display = "hidden";                     }                     else                     {                         $('.clkout_time').html("---");                     }                                  }     }); });   my html part is,
<div id="selecttime">     <label class="col-lg-4 control-label">select time</label>     <div class="input-group date col-lg-2" id="datetimepicker5" style="display:inline-flex;">         <select id="time_date1" class="form_control" name="time_date1">             <?php                   for($i=00;$i<=23;$i++)                  {                      echo '<option value='.$i.'>'.$i.'</option>';                  }             ?>         </select>         <select id="time_date2" class="form_control" name="time_date2">             <?php                   for($i=00;$i<=59;$i++)                  {                       echo '<option value='.$i.'>'.$i.'</option>';                  }              ?>         </select>         <select id="time_date3" class="form_control" name="time_date3">              <?php                   for($i=00;$i<=59;$i++)                  {                       echo '<option value='.$i.'>'.$i.'</option>';                  }              ?>         </select>     </div> </div>   here, want hide div if result above. how can this?
you have use
//this display:none in style $("#selecttime").hide();   and show use
//this remove  display:none style $("#selecttime").show();   please check document
Comments
Post a Comment