About details for these options, please see: Wiki.
It's will also useful for use with two input-fields.
-
<input type="text" id="date_foo" value=""> $('#date_foo').appendDtpicker({ "autodateOnStart": false });
<input type="text" id="date_foo" value=""> $('#date_foo').appendDtpicker({ "inline": true, "allowWdays": [1, 2, 3, 4, 5] // 0: Sun, 1: Mon, 2: Tue, 3: Wed, 4: Thr, 5: Fri, 6: Sat });
In normally, a picker has been shown/hidden by automatically when necessary.
But you can also catch it, And handle a picker by yourself with using methods of "handler" object.
<input type="text" id="date_foo" value=""> $('#date_foo').appendDtpicker({ "onShow": function(handler){ window.alert('Picker is shown!'); }, "onHide": function(handler){ window.alert('Picker is hidden!'); } });
<input type="text" id="date_jit" value=""> <input type="button" id="btn_generate" value="Generate a picker"> $('#btn_generate').click(function(){ window.alert("Generate"); $('#date_jit').appendDtpicker({ "onInit": function(handler){ handler.show(); }, "onHide": function(handler){ window.alert("Picker is hidden, Then destroy a picker"); handler.destroy(); } }); });
You can handle the appended picker with using "handleDtpicker" method into the input-field.
To handle a picker using handleDtpicker method, call the handleDtpicker method with setting the your hope method-name (e.g. "show" and more) as a parameter.
<input type="text" id="date_manual" value=""> <input type="button" id="btn_manual_generate" value="Generate"> <input type="button" id="btn_manual_show" value="Show"> <input type="button" id="btn_manual_hide" value="Hide"> <input type="button" id="btn_manual_destroy" value="Destroy"> <script type="text/javascript"> $(function(){ $('#btn_manual_generate').click(function(){ $('#date_manual').appendDtpicker({ "inline": true }); }); $('#btn_manual_show').click(function(){ $('#date_manual').handleDtpicker('show'); }); $('#btn_manual_hide').click(function(){ $('#date_manual').handleDtpicker('hide'); }); $('#btn_manual_get_date').click(function(){ var date = $('#date_manual').handleDtpicker('getDate'); window.alert(date.toString()); }); $('#btn_manual_set_date').click(function(){ $('#date_manual').handleDtpicker('setDate', new Date(2014, 04, 25, 0, 0, 0)); }); $('#btn_manual_destroy').click(function(){ $('#date_manual').handleDtpicker('destroy'); }); }); </script>