$('.datepicker').datepicker({
showWeek: true,
firstDay: 1,
showOtherMonths: true,
selectOtherMonths: true,
dateFormat: "dd.mm.yy",
showOn: "both",
buttonText: "Launch the Date Picker", // For accessibility purposes
buttonImage: 'http://www.aparchive.com/i/icon_datePicker_0001_calendar-default.png', // Change the url according to your need.
buttonImageOnly: false,
onSelect: function (dateStr, inst) {
$('.datepicker').show(); // Show the input before inserting date
$('.datepicker').html(dateStr);
}
});
.calendar {
display: inline-block; /* You can also use block but it will be harder to align the element inside without specifying an height to chidlren elements */
background: #e22e25; /* In case your linear gradient is not applied on older browser */
background: -moz-linear-gradient(top, #E22E25, #AC170F);
background: -webkit-gradient(linear, 0 0, 0 100%, from(#E22E25), to(#AC170F));
background: -webkit-linear-gradient(top, #E22E25, #AC170F);
background: -ms-linear-gradient(top, #E22E25, #AC170F);
background: -o-linear-gradient(top, #E22E25, #AC170F);
background: linear-gradient(to bottom, #E22E25, #AC170F);
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#E22E25', EndColorStr='#AC170F');
border: 1px solid #B1241C;
text-align: center; /* to center the input and button inside your div */
width: 200px;
}
.calendar label { /* Hide the label from screen but make it readable by screen readers. Add .js before to apply this style when javascript is enable */
position:absolute;
left:-10000px;
top:auto;
width:1px;
height:1px;
overflow:hidden;
}
.datepicker,
.ui-datepicker-trigger {
vertical-align: middle; /* To align input and button */
cursor: pointer;
height: 28px;
}
.no-js .datepicker {
/* Style according to your need */
}
.datepicker { /* Add .js before so that this style is applied when javascript is enable */
background: none;
border: none;
color: #fff;
padding: 0;
display: none; /* Hide the input if no value has been entered */
}
.datepicker:focus {
outline: 0;
}
.ui-datepicker-trigger {
display: inline-block;
width: 28px;
border: none;
background: none;
padding: 0;
}
.ui-datepicker-trigger img {
max-width: 70%;
height: auto;
}
<!-- Jquery UI script -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<!-- end script -->
<div class="calendar">
<label for="datepicker">Choose a date with the following format: dd.mm.yy</label>
<input id="datepicker" type="text" class="datepicker" /> <!-- input elements don't have closing tag -->
</div>