How to clear a DatePicker

前端 未结 2 462
攒了一身酷
攒了一身酷 2021-01-19 02:34

I have a DatePicker for selecting birthday.

This is going to be used for some filtering, and after the filtering, I will like the value to be

2条回答
  •  广开言路
    2021-01-19 02:53

    just add this code

    }).keyup(function(e) {
        if(e.keyCode == 8 || e.keyCode == 46) {
            $.datepicker._clearDate(this);
        }
    });
    

    You can use backspace to clear field even if it has in read only mode. Source

提交回复
热议问题