Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Disable Weekend’s in jQuery Datepicker

Nov 17, 2012
Introduction
  
Here I will explain how to disable weekend’s in jQuery datepicker.
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.

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.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

7 comments :

AZ-Pramod said...

but suresh how can i change dd mm yyyy format in this post it means i want date should like dd/MM/yyyy

Suresh Dasari said...

@Pramod lovete...
check this article http://www.aspdotnet-suresh.com/2012/05/changeset-date-format-in-jquery.html

Unknown said...

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?

Suresh Dasari said...

@kkrish jaiswal...
Check this article http://www.aspdotnet-suresh.com/2012/11/disable-specific-days-in-jquery-ui.html

Unknown said...

i want disable 2nd,4th saturday and sun day using jquery in C# asp.net, please help me

Unknown said...

can i except help from u guys

Unknown said...

Hi how can we merge both disable past date with weekends?

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.