Load the script (included in the lib directory) to enable formatting/validation etc. You can listen for the following events on the input.
countrychange This is triggered when the user selects a country from the dropdown.
if you enable Whether or not to allow the dropdown.
So for example adding a constraint of at least 6 characters will be like saying If the attribute is given it must be at least 6 characters.
Unfortunately even after minification it is still ~215KB, but if you use the option then it will only fetch the script when the page has finished loading (to prevent blocking).
If size is not a concern, then you can manually include the script yourself however you like, and as long as it has loaded before you initialise the plugin then it should work fine. to update the version of libphonenumber it is built from), see the contributing guide.
to populate a country dropdown - see example, or to modify - see example.
Note that any modifications must be done before initialising the plugin. If the Promise object is defined, one of those is returned so you can use and then modify that (see example) instead of having to generate the whole thing yourself - the country data has become increasingly complicated and for each country we now have five properties: the name, iso2 country code, international dial code, priority (in case two countries have the same international dial code), and finally a list of area codes used in that country - see for more info.
Also we display the selected flag on the right instead because it is just a marker of state. Instead of putting the country dropdown next to the input, append it to the specified node, and it will then be positioned absolutely next to the input using Java Script.