Description:
In previous posts I explained jQuery DatePicker example, Show multiple months in datepicker, Show datepicker on button click and many articles relating to JQuery and datepicker. Now I will explain how to disable weekend’s in jQuery datepicker.
In previous posts I explained jQuery DatePicker example, Show multiple months in datepicker, Show datepicker on button click and many articles relating to JQuery and datepicker. Now I will explain how to disable weekend’s in jQuery datepicker.
To
disable weekend’s in datepicker we need to write the code like this
<script type="text/javascript">
$(function()
{
$("#datepicker").datepicker({
beforeShowDay: $.datepicker.noWeekends });
});
</script>
|
If
you want to see it in complete example check below code
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>jQuery Datepicker: Disable all weekends</title>
<link rel="stylesheet"
href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css"
/>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script type="text/javascript">
$(function()
{
$("#datepicker").datepicker({
beforeShowDay: $.datepicker.noWeekends });
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
|
Demo
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
7 comments :
but suresh how can i change dd mm yyyy format in this post it means i want date should like dd/MM/yyyy
@Pramod lovete...
check this article http://www.aspdotnet-suresh.com/2012/05/changeset-date-format-in-jquery.html
Hello Suresh Sir...
How can I disable some days dynamically using this?
Ex.
In doctors application he will go for tour for next two days, then he dont want to take appointments on those days, then How can disable those two days?
@kkrish jaiswal...
Check this article http://www.aspdotnet-suresh.com/2012/11/disable-specific-days-in-jquery-ui.html
i want disable 2nd,4th saturday and sun day using jquery in C# asp.net, please help me
can i except help from u guys
Hi how can we merge both disable past date with weekends?
Note: Only a member of this blog may post a comment.