经批准后,警报电文将出现,有2个选项,即“k”和“cancel”。
如果有<代码>Ok和Cancel
, 请使用<代码>form要素。
当一个表格被压缩时,页面自动上载。
To prevent Page reload after Ok
button is clicked,
You should use preventDefault() method
html文档:
<form id="myForm">
<!-- your other tags here -->
<button type="reset" name="reset" >Cancel</button>
<button type="submit" name="status" value="2" class="btn btn-success btn-sm m-b-0-0 waves-effect waves-light" data-confirm="Are you sure you want to approve this leave application?" title="Approve">
<i class="fa fa-check"></i>
</button>
</form>
Javacast file:
document.addEventListener( DOMContentLoaded , function() {
document.getElementById( myForm ).addEventListener( submit , function(event) {
event.preventDefault();
// Rest of Your form submission logic here
});
});
if you want inline Javascript, place script
tag inside a head
tags
<head>
<!-- your other tags here -->
<script>
document.addEventListener( DOMContentLoaded , function() {
document.getElementById( myForm ).addEventListener( submit , function(event) {
event.preventDefault();
// Rest of Your form submission logic here
});
});
</script>
</head>
<body>
<!-- your other tags here -->
<form id="myForm">
<!-- your other tags here -->
<button type="reset" name="reset" >Cancel</button>
<button type="submit" name="status" value="2" class="btn btn-success btn-sm m-b-0-0 waves-effect waves-light" data-confirm="Are you sure you want to approve this leave application?" title="Approve">
<i class="fa fa-check"></i>
</button>
</form>
<!-- your other tags here -->
</body>