Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery datepicker displaying off a button click, is there a way to determine display state (show/hide)?

I'd like to make the button into a toggle but I looked at the docs and couldn't find a isHidden isVisible type of property...

.showCalendar is my button and #weekDate is my input field. Is there a way to get the display state of datepicker?

 $('.showCalendar').click(function () {
    $('#weekDate').datepicker("show");
 });
like image 708
PruitIgoe Avatar asked Dec 21 '22 18:12

PruitIgoe


1 Answers

You can check visibility of widget and toggle widget as following:

$(".dp-icon").click(function (event) {
    var visible = $(".has-dp").datepicker("widget").is(":visible");
    $(".has-dp").datepicker(visible ? "hide" : "show");
})
like image 81
Genc Hosting Avatar answered Jan 13 '23 17:01

Genc Hosting