Jump to content

Tel Field in custom hook


Recommended Posts


I am working on a custom hook and I find that just by adding an input field of type Tel, the country code is added by WHMCS.

I am basically showing a modal from my hook if a condition is met.

Now I am testing the example code on the IntlTelInput plugin website (https://intl-tel-input.com/node_modules/intl-tel-input/examples/gen/default-country-ip.html)

                    var input = document.querySelector("#phone");
                    window.intlTelInput(input, {
                      initialCountry: "auto",
                      geoIpLookup: function(callback) {
                        $.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) {
                          var countryCode = (resp && resp.country) ? resp.country : "us";
<input type="tel" id="phone">


But that's returning an error:


typeerror: window.intlTelInput is not a function

I basically want to sow the local country code in the form. is there a way to achieve this? bearing in mind that I am not in the tpl file, just echoing a modal from my hook.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated