如何将 Datatime-local 的值重置为默认值:“mm/dd/yyyy --:-- --”
<script type="text/javascript">
function addMinutes(date, minutes) {
var newdate = date.getTime() + minutes * 60000
var temp = new Date(newdate).toISOString();
return temp.toString().substr(0, 19);
}
$('#SelectIssuePriority').change(function () {
var selectedValue = $(this).val().split('|');
if (selectedValue != null && selectedValue != '') {
var newDate = addMinutes(new Date(), selectedValue[1]);
$('#EstimateTime').val(newDate);
} else {
$('#EstimateTime').val("mm/dd/yyyy --:-- --");
}
});
</script>
我把这个代码工作:jsfiddle.net/2BfnE