你能帮我解决这个问题吗?当我检查休假单选按钮时。它会覆盖病假功能。抱歉我的英语不好。
这是html
<div class="column-checkbox err-rbtn">
<div class="checkbox lv-1">
<label><input type="radio" class="cbselected" name="leavetype" value="" style="display:none;"></label>
</div>
<div class="checkbox lv-1">
<label><input type="radio" class="cbselected" id="SL" name="leavetype" value="SL" disabled onClick="sickleavecomp();">Sick Leave</label>
</div>
<div class="checkbox lv-2">
<label><input type="radio" class="cbselected" id="VL" name="leavetype" value="VL" disabled onClick="vacationleavecomp();">Vacation Leave</label>
</div>
<div class="checkbox lv-3">
<label><input type="radio" class="cbselected" name="leavetype" value="EL" disabled onClick="">Emergency Leave</label>
</div>
<div class="checkbox lv-3">
<label><input type="radio" class="cbselected" name="leavetype" value="PL" disabled>Paternity Leave</label>
</div>
<div class="checkbox lv-2">
<label><input type="radio" class="cbselected" name="leavetype" value="ML" disabled>Maternity Leave</label>
</div>
<div class="checkbox lv-3">
<label><input type="radio" class="cbselected" name="leavetype" value="CL" disabled>Compasionate Leave</label>
</div>
<div class="checkbox lv-3">
<label><input type="radio" class="cbselected" name="leavetype" value="UL" disabled>Unpaid Leave</label>
</div>
这是我正在使用的脚本。
function vacationleavecomp(a) {
$('.forvlrl').show();
$('.vl-carryover').show();
var vLeave = $('#u_user_blank_leave2').data('vleave');
$('#u_user_blank_leave2').val(vLeave);
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd
}
if (mm < 10) {
mm = '0' + mm
}
today = mm + '/' + dd + '/' + yyyy;
var checkcategory = $('#Category').val();
var carryovertotal = $('#CarryOver').val();
if (checkcategory == "Local") {
// $('#AvailableLeave').val('15');
// this script is for .04 per day...
$('#datepicker').on('change', function() {
var unval = $('#u_user_blank_leave2').val();
var probDate = new Date($('#forcomputeleave').val());
var nowDate = new Date($('#datepicker').val());
var timeDiff = Math.abs(probDate.getTime() - nowDate.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
var calc = Math.round((diffDays * 0.0416666666666667) * 100) / 100;
$('#AvailableLeave').val(calc);
var remain = Math.round((+calc - unval) * 100) / 100;
var remain2 = (+carryovertotal + (remain) * 100 / 100);
var totalremain = Math.round((remain2) * 100) / 100;
$('#Remainingleave').val(totalremain);
});
} else if (checkcategory == "Expat") {
// $('#AvailableLeave').val('30');
// this script is for .08 per day.
$('#datepicker').on('change', function() {
var unval = $('#u_user_blank_leave2').val();
var probDate = new Date($('#forcomputeleave').val());
var nowDate = new Date($('#datepicker').val());
var timeDiff = Math.abs(probDate.getTime() - nowDate.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
var calc = Math.round((diffDays * 0.0833333333333333) * 100) / 100;
$('#AvailableLeave').val(calc);
var remain = Math.round((+calc - unval) * 100) / 100;
var remain2 = (+carryovertotal + (remain) * 100 / 100);
var totalremain = Math.round((remain2) * 100) / 100;
$('#Remainingleave').val(totalremain) * 100 / 100;
});
}
}
function sickleavecomp() {
setTimeout(vacationleavecomp, 10);
$('.forvlrl').hide();
$('.vl-carryover').hide();
var sLeave = $('#u_user_blank_leave2').data('sleave');
$('#u_user_blank_leave2').val(sLeave);
$('#AvailableLeave').val('15');
var avail = $('#AvailableLeave').val();
var totalr = avail - sLeave;
$('#Remainingleave').val(totalr);
if (checkcategory == "Local") {
// $('#AvailableLeave').val('15');
// this script is for .04 per day...
$('#datepicker').on('change', function() {
});
} else if (checkcategory == "Expat") {
// $('#AvailableLeave').val('30');
// this script is for .08 per day.
$('#datepicker').on('change', function() {
});
}
}