Cleave.js: Cleave.js not working, give error => Uncaught Error: [cleave.js] Please check the element

Created on 31 Mar 2017  路  3Comments  路  Source: nosir/cleave.js

Hello cleave community and # support.

I downloaded the cleave.js-master from github, and included the cleave.min.js from cleave.js/dist/cleave.min.js , but My input is not getting formated.
in my console I am having an error
<<
Uncaught Error: [cleave.js] Please check the element

>
what is the cause and how can I solve this?

Most helpful comment

I'm assuming you're calling Cleave before the element has loaded, which is why it's throwing that error.

Use it like this:

document.addEventListener('DOMContentLoaded', () => {
    const cleave = new Cleave(fieldSelector, {
        phone: true,
        phoneRegionCode: phoneRegionCode
    });
});

All 3 comments

I'm assuming you're calling Cleave before the element has loaded, which is why it's throwing that error.

Use it like this:

document.addEventListener('DOMContentLoaded', () => {
    const cleave = new Cleave(fieldSelector, {
        phone: true,
        phoneRegionCode: phoneRegionCode
    });
});

Thanks @jpcaparas
Exactly, you need to get input element ready in your dom first

nosir, para usar cleave.js es necesario instalar el node.js, y luego correr npm value.js

ahora estoy trabajando con xampp, pero no me esta funcionando las entradas de los formatos, ya tengo los dos

Related issues

shaileshrathod128 picture shaileshrathod128  路  6Comments

CaptainYarb picture CaptainYarb  路  3Comments

periabyte picture periabyte  路  7Comments

qm3ster picture qm3ster  路  4Comments

melbon picture melbon  路  3Comments