Menu ▼



Posted By :
avatarmrkraju
Total Views : 2706

Show month and year dropdown in jQuery datepicker

This example shows you how to display the month and year dropdown in jQuery datepicker. To show month dropdown we need to set the changeMonth property value as "true" and to show year dropdown we need to set the changeYear property value as "true".

Example
Date :

<script language="javascript">
    $(document).ready(function () {
        $("#txtdate").datepicker({
            changeMonth: true,
            changeYear: true
        });
    });
</script>

Source code

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" rel="Stylesheet"
        type="text/css" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    <script language="javascript">
        $(document).ready(function () {
            $("#txtdate").datepicker({
                changeMonth: true,
                changeYear: true
            });
        });
    </script>
</head>
<body>
    Date :
    <input id="txtdate" type="text">
</body>
</html>






comments powered by Disqus


Search dotnetlearners.com