Skip to content

keyboard.accept(); not working when usePreview: false in change function #311

Description

@austb25

Hi!

When I set usePreview : true, (and reference keyboard.$preview.val() in my change function), my code works, but as soon as I change usePreview: false it breaks and when the user enters 4 characters the keyboard does not close & accept the input. Here is my code:

$('#yearInput').keyboard({
    layout: 'custom',
    customLayout: {
        'default': [
            '1 2 3',
            '4 5 6',
            '7 8 9',
            '0 {bksp}'
        ]
    },
    restrictInput: true, 
    preventPaste: true,
    autoAccept: true,
    maxLength: 4,
    usePreview: false,
    appendTo: '#date-filter',
    change: function(e, keyboard, el) {
        if (keyboard.$el.val().length >= 4) {
            keyboard.accept();  // I've also tried keyboard.accept(true);
            $('#submitButton').show();
        }
    }
});

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions