JavaScript & jQuery | 'jquery date picker' 시작날짜 이후로 마지막날짜 달력 보이기
작성자
jquery date picker를 사용해서
두개의 input창을 사용해서 시작날짜를 선택후 마지막날짜의 시작을 시작날짜 이후로 선택하려면 ..
 
1.
 

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>jQuery UI Datepicker - Default functionality</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script>
        $(function() {
            $("#start_date").datepicker({
                dateFormat: 'yy-mm-dd',
                showOn: 'button',
                buttonText: "start",
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                yearRange: 'c-1:c+10',
                minDate: '0d'
            });

            $("#end_date").datepicker({
                dateFormat: 'yy-mm-dd',
                showOn: 'button',
                buttonText: "start",
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                yearRange: 'c-1:c+10',
                minDate: '0d',
                beforeShow: function() {
                    var startDate = $("#start_date").datepicker('getDate');
                    //if a date was selected else do nothing
                    if (startDate != null) {
                        startDate.setMonth(startDate.getMonth());
                        $(this).datepicker('option', 'minDate', startDate);
                    }
                }

            });
        });
    </script>
</head>

<body>
    <p>start Date: <input type="text" id="start_date"></p>
    <p>end Date: <input type="text" id="end_date"></p>
</body>

</html>

 

2.

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>jQuery UI Datepicker - Default functionality</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script>
        $(function() {
            $("#from").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 3,
                onClose: function(selectedDate) {
                    $("#to").datepicker("option", "minDate", selectedDate);
                }
            });
            $("#to").datepicker({
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 3,
                onClose: function(selectedDate) {
                    $("#from").datepicker("option", "maxDate", selectedDate);
                }
            });
        });
    </script>
</head>

<body>
    <label for="from">From</label>
    <input type="text" id="from" name="from">
    <label for="to">to</label>
    <input type="text" id="to" name="to">
</body>

</html>

댓글목록

등록된 댓글이 없습니다.

총 게시물 93 개, 페이지 1 RSS
제목 작성자
기타 인스타 토큰받아오기
기타 sns 공유하기 소스 - 라인, 폴라, 카톡, 카스, 밴드, 핀터레스트, 구글플러스, 네이버블로그, 트위터, 페이스북 H
JavaScript & jQuery jQuery 다수의 Ajax 요청 처리 관련 H
JavaScript & jQuery parent() 활용 - 클릭한 클래스의 상위 클래스 찾아서 hide() H
JavaScript & jQuery 스크롤바 상단 고정메뉴 H
JavaScript & jQuery jquery 해당 클래스안에서 iframe name찾기, iframe과 iframe간 제어 H
JavaScript & jQuery jquery 파일업로드 미리보기 H
JavaScript & jQuery 'jquery date picker' 시작날짜 이후로 마지막날짜 달력 보이기 H
JavaScript & jQuery 정수로 반환하면서 NaN일때 0으로 처리 H
오류해결 Strict Standards: Assigning the return value of new by reference is deprecated in /home/goodbook/pub… H
오류해결 array_keys() [function.array-keys]: The first argument should be an array in H
오류해결 phpize 실행 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF enviro… H
오류해결 [phpmyadmin]mysqli 확장모듈을 불러올 수 없습니다.<br />PHP 환경설정을 검사하십시오 H
오류해결 Apache 재시작시 (98)Address already in use: make_sock:could not bind to address 0.0.0.0:80 H
오류해결 httpd: Syntax error on line 106 of /usr/local/server/apache/conf/httpd.conf: Cannot load /usr/local/… H
게시물 검색