This code find currrent date and if block compare the selected date is current date or not and then prompt alert!
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(function() {
$("#datepicker").datepicker();
var today = new Date();
var date = today.getDate();
var mnth = today.getMonth()+1;
var yyyy = today.getFullYear();
if(date<10){
date='0'+date;
}
if(mnth<10){
mnth='0'+mnth;
}
var today = mnth+'/'+date+'/'+yyyy;
alert(today); // Display current date
$(document).on("change", "#datepicker", function() {
if($(this).val()<=today)
{
alert($(this).val())
}
});
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
</html>
당신이 자바 스크립트의 날짜() 함수를 사용해야합니다, 당신은 그에게있어 그 값을 비교하거나 현재의 또는 이전보다 날짜 날짜 – clearshot66
@ j08691 풍자에 대한 감사 : – clearshot66
@ clearshot66 글쎄, 당신이 "당신은 자바 스크립트가 필요합니다"에서 귀하의 코멘트를 변경하기 전에 잘 맞습니다 – j08691