jQuery Datepicker: Prevent closing picker when clicking a date

后端 未结 9 2220
南方客
南方客 2020-11-29 08:16

Hi fellow stackoverflow:ers,

I\'m using the jQuery Datepicker plugin, together with Martin Milesich Timepicker plugin. Everything works great, except for the fact th

9条回答
  •  甜味超标
    2020-11-29 08:59

    Here is a solution :

    onSelect: function ( dateText, inst ) {
        ..... // Your code like $(this).val( dateText );`
    
    
        //Set inline to true to force "no close"
        inst.inline = true;
    },
    onClose: function(date,inst){
        //Set inline to false => datapicker is closed
        // onClose is called only if you click outside the datapicker, onSelect will not
        // trig onClose due to inline = true
       inst.inline = false;
    }
    

    `

提交回复
热议问题