Sandeep sandy Sandeep sandy - 1 year ago 179
jQuery Question

How to disable and enable datetimepicker jquery plugin

I have a requirement like enabling and disabling datetimepicker plugin from input box.

<select id="sel">
<option value="opt1" data-type="date">opt1</option>
<option value="opt2" data-type="string">opt2</option>
</input><input id="inp">

$('#sel').on('change', function(){
var type = $('this').find('option:selected').data(type);
if(type == 'date'){
//enable calendar
} else {
//need to disable

Want to enable if type is date if not need to disable calendar. Any help appreciable.

Answer Source

If you'll find time and read datetimepicker manual you will see a couple of methods even with examples:

hide - Hide Datetimepicker

toggle - Show/Hide Datetimepicker

destroy - Destroy datetimepicker

Now, choose which one you want.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download