"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Wednesday, July 14, 2010

Prevent Users from Selecting Weekends using jQuery UI DatePicker

 Hi friends,
Not known to many, jQuery UI DatePicker has a built-in function called 'noWeekends', that prevents users from selecting weekends, by disabling them.

Here’s how to use it

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link rel="Stylesheet" type="text/css" href="http://ajax.googleapis.
com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />
    <script  type="text/javascript" src="http://ajax.microsoft.com/ajax/
jquery/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jqueryui/1.8.2/jquery-ui.min.js"></script>


    <script type="text/javascript">
        $(function() {
            $("#datepic").datepicker(
            { beforeShowDay: $.datepicker.noWeekends }
            );
        });
    </script>
</head>
<body>
  <input id="datepic"/>
</body>
</html>
 
it's very use full 'n simple ,i hope it helps u some way 
 
Have a nice day... 'N happy Coding :)

 jQuery in Action, Second EditionjQuery Cookbook: Solutions & Examples for jQuery Developers (Animal Guide)Learning jQuery 1.3

No comments: