Add Date Picker in SharePoint 2016/2013/Online using JavaScript Object Model (jsom)

Add DatePicker control in SharePoint 2013 site
SharePoint deveopment training course

This SharePoint 2013 tutorial explains, how to add a date picker into a SharePoint 2013/2016/Online site. Date Picker in SharePoint will allow us to select a date from the calendar control. In this example, we will put an input box and whenever a user clicks on the input box, the date picker will appear and the user should be able to select a date from the date picker.

In this example, we will write the client side code using a script editor web part or content editor web part in SharePoint.

Open the SharePoint iste and open the web part page. Edit the page, then Add a Script Editor web part from the Media and Content Category and place the below code. Now save the page.

<link rel=”stylesheet” href=”http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css” />
<script src=”http://code.jquery.com/jquery-1.8.3.js”></script>
<script src=”http://code.jquery.com/ui/1.10.0/jquery-ui.js”></script>

<script>
$(function() {
$( “#fromdatepicker” ).datepicker();
});
$(function() {
$(“#btnSubmit”).click(function() {
var startDate = $(“#fromdatepicker”).datepicker(“getDate”);
startDate = startDate.getFullYear()+”-“+(startDate.getMonth()+1)+”-“+startDate.getDate();

alert(startDate);
});
});
</script>

Select a Date: <input type=”text” id=”fromdatepicker”/>
<input type=”button” id=”btnSubmit” value=”Get Date”>

Now when you click on the button, it will display the date in the alert box.

Add DatePicker control in SharePoint 2013 site
Add DatePicker control in SharePoint 2013 site

You may like following SharePoint jsom tutorials:

Hope this SharePoint tutorial helps to Add Date Picker in SharePoint 2016/2013/Online using JavaScript Object Model (jsom).

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →