I'm having an issue with trying to add multiple hiddenInput fields to intl-tel-input
Package github: https://github.com/jackocnr/intl-tel-input
Code I've tried:
<script>
var phone_number = window.intlTelInput(document.querySelector("#phone_number"), {
preferredCountries:["al"],
hiddenInput: "['iso','code']", // Output: "['iso','code']" => "+355123123"
utilsScript: "//cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.3/js/utils.js"
});
$("form").submit(function() {
var isoCode = phone_number.getSelectedCountryData().iso2;
var dialCode = phone_number.getSelectedCountryData().dialCode;
var iso = $("input[name='phone[iso]'").val(isoCode);
var dial = $("input[name='phone[dial]'").val(dialCode);
});
</script>
Another code I tried for the hiddenInput:
hiddenInput: "dialCode",
hiddenInput: "isoCode",
The output was it read the isoCode only totally ignoring the dialCode.
I'm running out of thoughts on how to get this fixed.