I wish to do something like this:
var showme = false;
$('#mydatepicker').datepicker({
beforeShow: function(input, inst) {
if(!showme) {
//stop showing
}
}
});
But disable, nor hide seems to work. I'd like to do something that works like preventDefault, but I don't think it'll work in this case.
I had the same question, and have discovered that you can now use return false;
to prevent the calendar from showing.
$('#mydatepicker').datepicker({
beforeShow: function(input, inst) {
if(!showme) {
return false;
}
}
});
I'm using version 1.7.2 of jQuery UI
Looking through the source, it doesn't look like that is possible currently. You might be able to request that as a feature. If you really want to make it stop (though this is probably a bad idea) you could throw an error in that function. Though this will cause errors to show up for your page and probably is not an option.
Note: I submitted a patch for this and it's now in the released jQuery UI (at least v1.9 and later), although the documentation doesn't mention it. return false
in beforeShow
will prevent the datepicker from appearing (now).
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