Using jQuery Date picker with a custom trigger button

后端 未结 6 1647
伪装坚强ぢ
伪装坚强ぢ 2021-02-20 08:37

How do I make the jQuery Datepicker open up by a user defined button?

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-20 09:22

    This is HTML for date picker icon

    onclick="show_date_picker('#datepicker_id');  on you icon element
    

    This is function for open & close datepicker on icon click

    function show_date_picker(source_datepicker){
        if($(source_datepicker).datepicker("widget").is(":visible")){
            $(source_datepicker).datepicker("hide");
        }else{ 
            $(source_datepicker).datepicker("show"); 
        }
    }
    

提交回复
热议问题