Can't clear date with readonly datetime picker

Can't clear date with readonly datetime picker

RoseReyesRoseReyes Posts: 2Questions: 1Answers: 0

Hi, I'm having an issue with deleting values using backspace and delete keys in a readonly datetime picker. I've tried using the Jquery _clearDate but it doesn't work.

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

I've been searching the forums and I can't seem to find one that solve my problem. Any help would be gladly appreciated.

Thanks!

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    If it's readonly, would you expect people to delete values? I'm not clear what the intention is.

    Could you link to your page, please, so we can see the issue, or update this test case here.

    Colin

  • RoseReyesRoseReyes Posts: 2Questions: 1Answers: 0
    edited June 2020

    Hi @colin,

    Yes, I want the user to delete values even if i'ts readonly.
    I resolved my issue by adding the .input()

    editor.field('#elementid').input().on('keyup', function (e) {
    if (e.keyCode == 8 || e.keyCode == 46) {
    clear it
    }
    });

    Thanks for the response though!.

This discussion has been closed.