mdbootstrap / bootstrap-templates

A collection for Bootstrap 5 templates.

Home Page:https://mdbootstrap.com/freebies/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enter key submitting form, but can't make to be a confirm key

djmassive opened this issue · comments

I've try to use:

   `$(".tags").tagsinput({
	cancelConfirmKeysOnEmpty: true,
	confirmKeys: [13, 44]
});`

But after I hit enter, whole form is submitting. I've try to block enter key on form with prevent - doesn't work too.

Another problem - after I use , as separator - its stays in field (screenshot)

zrzut ekranu 2018-02-15 o 13 02 18

Hi @djmassive currently I have the same issue, I'm using this to solve for now

    $('.bootstrap-tagsinput input[type=text]').on('keydown', function (e)
        {
            if (e.which == 188) //188 = comma
            {
                $(this).blur();
                e.preventDefault();
                $(this).focus();
            }
        });

Regards

Try this

    $('input[name=tags]').tagsinput();
    $('.bootstrap-tagsinput input').keydown(function( event ) {
        if ( event.which == 13 ) {
            $(this).blur();
            $(this).focus();
            return false;
        }
    })