0

For Anybody familiar with cleave.js out there. am I able to get the country code digit? in this case here for Italy, am I able to access the 39 for Italy? I am working on a form that will auto complete and show the country code (digits) and could not find a way to grab the digits.

new Cleave('.my-input', {
    phone: true,
    phoneRegionCode: 'IT'
});
Lucky500
  • 677
  • 5
  • 17
  • 31

1 Answers1

0

Yes looks right, what error did you see while running.

let cleaverObj = new Cleave('.my-input', {
    phone: true,
    phoneRegionCode: 'IT'
});

or if you just want to get the information you collected, store the object of Cleaver in any variable like above. so that you can use it anywhere.

Rohit Bhati
  • 371
  • 2
  • 11
  • Thanks Rohit. I am still not sure how to access the digit for the country code. – Lucky500 Aug 07 '22 at 15:16
  • 1
    Well I guess you want to extract the country code itself, so in short you can't do that because Cleave.js will only format input field according to country code – Rohit Bhati Aug 08 '22 at 03:31