Introduction
In this blog, we will see how to use jQuery to create the calendar dynamically.
For every application, there is a basic need to select a date from the calendar control. In this application, we will see how to use the calendar control of jQuery for HTML textbox, when the focus is on the textbox.
Step 1
First, write your design part for calendar. See the code given below to create your calendar.
- <asp:TextBox ID="txtDate" runat="server"></asp:TextBox> <br /> <br />
- <div id="Calendar" class="cal" style="display:none">
- <div id="Calender_Header" class="calheader">
- <asp:ImageButton ID="prvbtn" Width="32" Height="32" class="prv" ImageUrl="~/previousbutton.png" runat="server" />
- <asp:LinkButton ID="Calendar_Month_Year" ForeColor="White" class="link" Font-Underline="false" runat="server"></asp:LinkButton>
- <asp:ImageButton ID="nextbtn" class="next" Width="32" Height="32" ImageUrl="~/nextbtn.png" runat="server" /> </div>
- <div id="Calendar-Dates" class="calbody"></div>
Step 2
Second step is to create stylesheet for the calendar. Calendar header, body content, hover style for calendar.first extracts the calendar and uses the style sheet.
Step 3
Write your own style of code in jQuery.
Step 4
To see the jQuery DynamicCalendar.js, now run your Application and see the result given below.