본문 바로가기
Web/jQuery

[jQuery] datepicker 예제

by 나비와꽃기린 2016. 7. 20.

두개의 달력 ()~() 범위에서 minDate, maxDate 설정@@


$("#datepicker1").datepicker({

dateFormat:'yy-mm-dd'

,showMonthAfterYear : true

,changeMonth : true

,changeYear : true

,numberOfMonths:1

,showOn:'both'

,buttonImage:'/images/iconCalendarSmall.gif' 

,buttonImageOnly :true 

,buttonText :"날짜선택"

,dayNamesMin : ['일','월','화','수','목','금','토']

,monthNamesShort:['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월']

,onClose:function(selectedDate){

$('#datepicker2').datepicker("option","minDate",selectedDate);

}

//,minDate : -0 //오늘날짜 이후부터만 설정되게

});

$("#datepicker2").datepicker({

dateFormat:'yy-mm-dd'

,showMonthAfterYear : true

,changeMonth : true

,changeYear : true

,numberOfMonths:1

,showOn:'both'

,buttonImage:'/images/iconCalendarSmall.gif' 

,buttonImageOnly :true 

,buttonText :"날짜선택"

,dayNamesMin : ['일','월','화','수','목','금','토']

,monthNamesShort:['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월']

,onClose:function(selectedDate){

$('#datepicker1').datepicker("option","maxDate",selectedDate);

}

//,minDate : -0 //오늘날짜 이후부터만 설정되게

});

댓글0