datepicker.js minDate에 대한 질문입니다. 채택완료
세진컴퓨터랜드
2년 전
조회 1,967

오늘은 7월 20일이고 minDate인 21일이 기본적으로 표시되어 있습니다.
달력이 로딩될 때, 21일의 백그라운드가 표시 안된 상태에서,
클릭하면 클릭한 날짜의 백그라운드 색상을 채우게 하고 싶습니다.
어떤 방법이 있을까요?
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
채택된 답변
+20 포인트
2년 전
https://jqueryui.com/datepicker/
https://api.jqueryui.com/datepicker/#option-beforeShow
beforeShow 옵션이 기대하는 기능에 도움이 될지 모르겠습니다.
</p>
<p><!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="<a href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">" target="_blank" rel="noopener noreferrer">https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css"></a>
<link rel="stylesheet" href="<a href="https://jqueryui.com/resources/demos/style.css">" target="_blank" rel="noopener noreferrer">https://jqueryui.com/resources/demos/style.css"></a>
<script src="<a href="https://code.jquery.com/jquery-3.6.0.js"></script>" target="_blank" rel="noopener noreferrer">https://code.jquery.com/jquery-3.6.0.js"></script></a>
<script src="<a href="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>" target="_blank" rel="noopener noreferrer">https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script></a>
<script>
$( function() {
$( "#datepicker" ).datepicker({
minDate: '+1D',
// gotoCurrent: false,
beforeShow: function (input, dpobj) {
var widget = $( "#" + input.id ).datepicker( "widget" );
setTimeout(function () {
widget.find('a.ui-state-highlight').removeClass('ui-state-highlight');
widget.find('a.ui-state-hover').removeClass('ui-state-hover');
}, 0);
}
});
} );
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
</html></p>
<p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인