Change allowed dates after form load?

megana 14 May, 2015
Anyone know if there's a way to change the dates allowed on the datepicker via JavaScript? There's a long explanation why I need to do it that way...

I tried adding a Load JS event and using this code to allow only Sundays:

window.addEvent('domready', function() {
document.getElementById("run_date").setAttribute("data-open_days", "[0]");

When I view the page source, I can see that technically it works:
<input name="run_date" id="run_date" value="" data-gdatetimepicker-format="m/d/Y" placeholder="" size="" class="form-control A" title="" style="" data-load-state="" data-tooltip="" type="text" data-fieldtype="gdatetimepicker" data-open_days="[0]" data-start_view="d">

But when the calendar pops up, it still allows all dates. I think maybe the JS needs to run in a different order? But I don't know how I would change that.

Or maybe there's some other better way to do this?
megana 15 May, 2015
Ahh figured it out...use jQuery(document).ready(function($) instead of window.addEvent('domready', function()...
GreyHead 16 May, 2015
Hi megana,

Well found ;-)

For other readers in jQuery this would look something like
jQuery(document).ready(function (jQ) {
  jQ('#run_date').prop('data-open_days', '[0]');

This topic is locked and no more replies can be posted.