I have multiple datepicker controls on single page binded to input controls. When I click on any of the input control datepicker control linked to that input gets visible.
Now I want to get input for which the current instance of datepicker is being shown on another JS events. Is it possible?
You can try using the $.datepicker._getInst(target)
method to get any specific datepicker on your page. You just have to pass in a target element, which you can do so by just passing the id using document.getElementById (don't use JQuery or it will return undefined).
So like so:
var id = document.getElementById('someId');
//replace someId with the id of the datepicker currently visible.
var inst = window.$.datepicker._getInst(id);
This is especially helpful if you are trying to get the current instance of a datepicker that's an inline element (not attached to an input).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With