N
N
NeveR3d2018-03-06 22:34:32
JavaScript
NeveR3d, 2018-03-06 22:34:32

Map input not working on android?

There is a field

<input type="text" class="cardnumber" name="cardcode" pattern="[0-9]{4}\s[0-9]{4}\s[0-9]{4}\s[0-9]{4}" placeholder="XXXX XXXX XXXX XXXX">

there is a code
var cc = myform.cardcode;
    for (var i in ['input', 'change', 'blur', 'keyup']) {
        cc.addEventListener('input', formatCardCode, false);
    }
    function formatCardCode() {
        var cardCode = this.value.replace(/[^\d]/g, '').substring(0,16);
        cardCode = cardCode != '' ? cardCode.match(/.{1,4}/g).join(' ') : '';
        this.value = cardCode;
    }

I can’t understand, like the android keyboard opens, but when you enter 4 digits, you have to enter everything again

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question