Search code examples
vue.jsbootstrap-datetimepicker

vue-bootstrap-datetimepicker input typing permission block without disabled & readonly


I'm using vue-bootstrap-datetimepicker in my project. It's works fine.

But I faced an error in this picker input typing time. So I need to block that input typing.

If I use disabled & readonly the focus is not working. So the picker popup will not show. (picker functionalities do not trigger)

Is there a better solution?


Solution

  • this is use to prevent input typing. you need to paste the below code to your component mounted function. because after render datepicker keydown listener need to start. i think this will help

    mounted () {
            $(`#${DATE_PICKER_ID}`).keydown((ev) => {
              ev.preventDefault();
            });
        },