본문 바로가기

Dev

jQuery Datepicker 랜더링

728x90


<link rel="stylesheet" href="css/jquery-ui-themes-1.12.1/themes/cupertino/jquery-ui.css">

<script type="text/javascript" src="js/jquery-2.1.3.js"></script>

<script type="text/javascript" src="js/jquery-ui.js"></script>


<script type="text/javascript">

/* Korean initialisation for the jQuery calendar extension. */

/* Written by DaeKwon Kang (ncrash.dk@gmail.com), Edited by Genie and Myeongjin Lee. */

( function( factory ) {

if ( typeof define === "function" && define.amd ) {


// AMD. Register as an anonymous module.

define( [ "../widgets/datepicker" ], factory );

} else {


// Browser globals

factory( jQuery.datepicker );

}

}( function( datepicker ) {


datepicker.regional.ko = {

closeText: "닫기",

prevText: "이전달",

nextText: "다음달",

currentText: "오늘",

monthNames: [ "1월","2월","3월","4월","5월","6월",

"7월","8월","9월","10월","11월","12월" ],

monthNamesShort: [ "1월","2월","3월","4월","5월","6월",

"7월","8월","9월","10월","11월","12월" ],

dayNames: [ "일요일","월요일","화요일","수요일","목요일","금요일","토요일" ],

dayNamesShort: [ "일","월","화","수","목","금","토" ],

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

weekHeader: "주",

dateFormat: "yy.mm.dd",

firstDay: 0,

isRTL: false,

showMonthAfterYear: true,

yearSuffix: "년" };

datepicker.setDefaults( datepicker.regional.ko );


return datepicker.regional.ko;


} ) );


$(document).ready(function(){ 
 /** 달력 열기 / 날짜선택 **/ 
 $(".jDatepicker").datepicker({ 
 onSelect : function(dateText, inst){ alert(dateText+"을 선택하셨습니다."); 
$("#navcalendar").on("click", function(){ $(".jDatepicker").datepicker("show");
 });

});
</script>


<span class="dateimg"><!-- 텍스트 박스 숨기고 이미지 클릭 시에만 달력 나오도록 -->

<input type="text" class="jDatepicker" style="display:none;">

<img id="navcalendar" src="img/calendar.jpg">

</span>