For the “kiddie scripters” like myself who require detailed instructions on what to do after just copying and pasting the code, and wondering why it’s not working.
- You need to change the “cleave-phone.XX.js” to the country code you want to use.
- You need to find the input field number of the form you’re using by right clicking it and selecting “Inspect”.
- You need to change the “phoneRegionCode:” to country code you’re after which will be the same value as step#1.
- You will probably need to do this for every form that you enter a phone number in.
//For NZ telephone number format//
LazyLoad.js([
‘https://cdnjs.cloudflare.com/ajax/libs/cleave.js/1.6.0/cleave.min.js’,
‘https://cdnjs.cloudflare.com/ajax/libs/cleave.js/1.6.0/addons/cleave-phone.nz.js’
], function () {
console.log(‘js loaded!’);
});
$(document).on(‘knack-scene-render.any’, function(event, scene) {
var cleave = new Cleave(‘#field_164’, {
phone: true,
phoneRegionCode: ‘NZ’
});
});