javascript - How to change options of bootstrap datetimepicker after initialization? - Stack Overflow

I am using the bootstrap date time picker jQuery plugin by eonasdan: I initalize it like so: $('#

I am using the bootstrap date time picker jQuery plugin by eonasdan: /

I initalize it like so:

$('#datetimepicker').datetimepicker({
          format: 'MM DD YYYY',
          inline: true,
          daysOfWeekDisabled: [0,6]
});

After initializing the calendar, I want to be able to change the contents of the daysOfWeekDisabled array (an option) based on user input from an html form dynamically. I was wondering whether there is a possible solution for this, as I have scoured the docs and Google but wasn't able to find an adequate answer. I am a beginner in javascript.

Would the solution entail modifying the js file of the plugin or is there some simple javascript code you can write to do this? Any and all help would be greatly appreciated.

Thank you all

I am using the bootstrap date time picker jQuery plugin by eonasdan: https://eonasdan.github.io/bootstrap-datetimepicker/

I initalize it like so:

$('#datetimepicker').datetimepicker({
          format: 'MM DD YYYY',
          inline: true,
          daysOfWeekDisabled: [0,6]
});

After initializing the calendar, I want to be able to change the contents of the daysOfWeekDisabled array (an option) based on user input from an html form dynamically. I was wondering whether there is a possible solution for this, as I have scoured the docs and Google but wasn't able to find an adequate answer. I am a beginner in javascript.

Would the solution entail modifying the js file of the plugin or is there some simple javascript code you can write to do this? Any and all help would be greatly appreciated.

Thank you all

Share Improve this question asked Jun 2, 2016 at 3:34 Abhas AryaAbhas Arya 4701 gold badge6 silver badges19 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

As doc mention: https://eonasdan.github.io/bootstrap-datetimepicker/Functions/

All functions are accessed via the data attribute e.g. $('#datetimepicker').data("DateTimePicker").FUNCTION()

so you can change daysOfWeekDisabled by using following colde:

$('#datetimepicker').data('DateTimePicker').daysOfWeekDisabled([1, 2]);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744293924a4567167.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信