$(function () {
$('#datepicker').datepicker({
showOn: 'button',
buttonImage: "images/calendar.png", // File (and file path) for the calendar image
buttonImageOnly: false,
buttonText: 'Calendar View',
dayNamesShort: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
showButtonPanel: true,
closeText: 'Close',
onClose: removeAria
});
// Add aria-describedby to the button referring to the label
$('.ui-datepicker-trigger').attr('aria-describedby', 'datepickerLabel');
dayTripper();
});
function dayTripper() {
$('.ui-datepicker-trigger').click(function () {
setTimeout(function () {
var today = $('.ui-datepicker-today a')[0];
if (!today) {
today = $('.ui-state-active')[0] ||
$('.ui-state-default')[0];
}
// Hide the entire page (except the date picker)
// from screen readers to prevent document navigation
// (by headings, etc.) while the popup is open
$("main").attr('id','dp-container');
$("#dp-container").attr('aria-hidden','true');
$("#skipnav").attr('aria-hidden','true');
// Hide the "today" button because it doesn't do what
// you think it supposed to do
$(".ui-datepicker-current").hide();
today.focus();
datePickHandler();
}, 0);
});
}
function datePickHandler() {
var activeDate;
var container = document.getElementById('ui-datepicker-div');
var input = document.getElementById('datepicker');
if (!container || !input) {
return;
}
$(container).find('table').first().attr('role', 'grid');
container.setAttribute('role', 'application');
container.setAttribute('aria-label', 'Calendar view date-picker');
// the top controls:
var prev = $('.ui-datepicker-prev', container)[0],
next = $('.ui-datepicker-next', container)[0];
// This is the line that needs to be fixed for use on pages with base URL set in head
next.href =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.