Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ahmetaksungur/akstelephoneinput

International Telephone Numbers
https://github.com/ahmetaksungur/akstelephoneinput

input international international-telephone international-telephone-numbers tel telephone telephone-number

Last synced: about 6 hours ago
JSON representation

International Telephone Numbers

Awesome Lists containing this project

README

        

# aksTelephoneInput.js
International Telephone Numbers

**[View the Demo on CodePen →](https://codepen.io/collection/pggzPE)**

![aksTelephoneInput](https://github.com/Ahmetaksungur/akstelephoneinput/blob/main/8d60f5dfb57b44b19390f654bd07c85513_57_19.gif?raw=true)

## Getting Started

Compiled and production-ready code can be found in the `dist` directory.

### 1. Include aksTelephoneInput.min.js on your site.

**Direct Download**

You can [download the files directly from GitHub](https://github.com/Ahmetaksungur/akstelephoneinput/archive/main.zip).

```html

```

```html

```

**CDN**

```html

```

```html

```
---

```html

```

```html

```

**jQuery**

```html

```
---

**NPM**

```bash
npm i akstelephoneinput
```

## Document aksTelephoneInput.js

```html

```

```js
$("#tel").aksTelephoneInput({
valueNumberCode: false,
flagsUrl: "https://unpkg.com/[email protected]/flags/"
});
```
[Sample](https://codepen.io/ahmetaksungur/pen/abJwOzz).

### Auto Country

```js
$("#tel").aksTelephoneInput({
valueNumberCode: false,
autoCountry: true,
geoCountries: function (callback) {
$.get("https://ipwhois.app/json/", function (data) {
callback(data.country_code);
});
},
flagsUrl: "https://unpkg.com/[email protected]/flags/"
});
```
[Sample](https://codepen.io/ahmetaksungur/pen/ExWXjPa).

### Change Country

```js
$("#tel").aksTelephoneInput({
valueNumberCode: false,
changeCountry: function () {
console.log(this);
},
flagsUrl: "https://unpkg.com/[email protected]/flags/"
});
```
[Sample](https://codepen.io/ahmetaksungur/pen/WNpOvwg).

### Attributes

```js
allCountries: [],
onlyCountries: [],
primaryCountries: [],
currentCountries: "",
autoCountry: false,
geoCountries: function (callback) {
$.get("https://ipwhois.app/json/", function (data) {
callback(data.country_code);
});
},
changeCountry: function () {},
placeholderNumber: true,
valueNumberCode: false,
searchBar: true
```

## License

The code is available under the [MIT License](https://github.com/Ahmetaksungur/akstelephoneinput/blob/main/LICENSE).