From 2a67476ef4235ca08c03038a2a093f6e51ff8e21 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Mon, 13 Jan 2014 00:16:05 -0800 Subject: [PATCH] examples --- examples/default-country-ip.html | 34 +++++++++++++++++++++++++++++ examples/modify-country-data.html | 34 +++++++++++++++++++++++++++++ examples/only-countries-europe.html | 5 +++-- 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 examples/default-country-ip.html create mode 100644 examples/modify-country-data.html diff --git a/examples/default-country-ip.html b/examples/default-country-ip.html new file mode 100644 index 000000000..448261935 --- /dev/null +++ b/examples/default-country-ip.html @@ -0,0 +1,34 @@ + + + + + International Telephone Input + + + + + +

Example: defaultCountry

+

Use IP address lookup to set the defaultCountry to the user's country

+ +

Code

+
$.get("http://ipinfo.io", function(response) {
+  $("input").intlTelInput({
+    defaultCountry: response.country.toLowerCase()
+  });
+}, "jsonp");
+ +

Result

+ + + + + + + \ No newline at end of file diff --git a/examples/modify-country-data.html b/examples/modify-country-data.html new file mode 100644 index 000000000..0762a934f --- /dev/null +++ b/examples/modify-country-data.html @@ -0,0 +1,34 @@ + + + + + International Telephone Input + + + + + +

Example: getCountryData()

+

Use static getCountryData() to update the data to only show localised country names

+ +

Code

+
var countryData = $.fn.intlTelInput.getCountryData();
+$.each(countryData.countries, function(i, country) {
+  country.name = country.name.replace(/.+\((.+)\)/,"$1");
+});
+("input").intlTelInput();
+ +

Result

+ + + + + + + \ No newline at end of file diff --git a/examples/only-countries-europe.html b/examples/only-countries-europe.html index 1cbecf246..cfa6a794d 100644 --- a/examples/only-countries-europe.html +++ b/examples/only-countries-europe.html @@ -8,8 +8,9 @@ -

Example: onlyCountries set to array of European country codes

- +

Example: onlyCountries

+

Set onlyCountries array to just European country codes

+

Code

$("input").intlTelInput({
   onlyCountries: ["al", "ad", "at", "by", "be", "ba", "bg", "hr", "cz", "dk", "ee", "fo",