Menu ▼



Posted By :
avatarmrkraju
Total Views : 3670

JQuery Date Picker disable weekends.

To disable the weekends in jquery date picker we need to set the "beforeShowDay" property value to "$.datepicker.noWeekends", then all the Weekends will be disabled in the date picker control.

Example
Date :

JQuery
<script language="javascript">
    $(document).ready(function () {
        $("#txtworkingdays").datepicker({
            beforeShowDay: $.datepicker.noWeekends
        });
    });
</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 () {
            $("#txtworkingdays").datepicker({
                beforeShowDay: $.datepicker.noWeekends
            });
        });
    </script>
</head>
<body>
    Date :
    <input id="txtworkingdays" type="text">
</body>
</html>





comments powered by Disqus


Search dotnetlearners.com