我正在使用PHP和JS为员工系统编程创建一个考勤系统。
我有一个名为ADD的按钮-添加新记录 和EDIT按钮来编辑插入的记录
我需要做一些事情,以便当工作人员通过单击“添加”按钮记录时间开始时,我想隐藏时间结束并在仅单击“编辑”按钮时显示>>
该怎么做?
$(document).ready(function() {
$('#add_button').click(function() {
$('#product_form')[0].reset();
$('.modal-title').text("Add record");
$('#action').val("Add");
$('#operation').val("Add");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Add record form in fact it same when click edit same form but I need to hide time-end when click ADD .
<div id="productModal" class="modal fade">
<div class="modal-dialog">
<form method="post" id="product_form">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">ADD NEW RECORD</h4>
</div>
<div class="modal-body" dir="rtl">
<label>STAFF NAME</label>
<input type="text" name="attendance_name" id="attendance_name" class="form-control" value="<?php echo $_SESSION['user']['fname'];?> <?php echo $_SESSION['user']['lname'];?>" />
<br />
<label>ID NO</label>
<input type="text" name="attendance_username" id="attendance_username" class="form-control" value="<?php echo $_SESSION['user']['username'];?>" />
<br />
<label>TIME LOGIN </label>
<input type="text" value="<?php echo " " . date("h:i:s ");
?>" name="attendance_start" id="attendance_start" class="form-control" />
<br />
<label>TIME LOGOFF </label>
<h1>Here I need to hide input for add record and show when click button EDIT</h1>
<br />
</div>
<div class="modal-footer">
<input type="hidden" name="attendance_id" id="attendance_id" />
<input type="hidden" name="operation" id="operation" />
<input type="submit" name="action" id="action" class="btn btn-success" value="Add" />
</div>
</div>
</form>
</div>
</div>