Monday, 11 January 2016

JQuery UI: Datepicker- Set Range of year and choose your own date format


  • For using any kind of  libraries, it's better to go online and find the updated one and link it to your website. 
  • So for using JQuery Datepicker, first goto Jquery CDN and get the updated library.
  • Get these three libraries and give reference to your website:
  1. jquery-ui.css
  2. jquery-1.10.2.js
  3. jquery-ui.js

  • Now include one textbox in page .
















  • Add script for datepicker as shown for allowing user to select the date.


























  • Now just run the website you'll see something like this while clicking on textbox.






  • Notice if you want to select year 2010 or before how ridiculous it would be by going one-by-one step back.
  • So for removing this you have to add some parameters to datepicker as shown in figure.
  • Script block shows you how to set Month & Year dropdown to be visible and set year range and how to get value in your desired format.








  • This is it now just run the website and click on textbox you'll be able to see what you desired.





No comments:

Post a Comment

How To Pass An Array As A Parameter While Calling an ASP.NET Web API C#

Please visit my C# Corner Blog for this, where I have provided better efforts to make this concept more understandable - www.c-sharpcorner....