2.0.6 • Published 4 years ago

int-phone-input v2.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

international-phone-input

A Javascript library for showing an international phone number selection input. It adds a flag dropdown to any input.

Image 1

Table of Contents

Getting Started

  1. Download the latest release
  2. Include the css file
<link rel="stylesheet" href="path/to/intPhone.css">
  1. Add the library plugin script and initialise it on your input element
<input type="tel" id="phone">

<script src="path/to/intPhone.js"></script>
<script>
  var intPhone = $("#phone").intPhone();
</script>

Methods

getPhone

Returns the complete phone number including the country code.

var phone = intPhone.getPhone();

setCountryCode

Receives a String containing an iso2 country code and sets the specified value to the instance.

intPhone.setCountryCode("US"); // Sets all values to the ones belonging to the United States

getCountryCode

Returns the country code.

// Following the previous example the value returned is US
var countryCode = intPhone.getCountryCode();

getPhoneCode

Returns the phone code.

// Following the previous example the value returned is 1, because US phone code is +1
var phoneCode = intPhone.getPhoneCode();

getSimplePhone

Returns the phone number without the code

var phoneCode = intPhone.getSimplePhone();

setSimplePhone

Sets the phone number without the initial phone code

intPhone.setSimplePhone("3334445555");

Dependencies

2.0.5

4 years ago

2.0.4

4 years ago

2.0.6

4 years ago

2.0.3

4 years ago

1.0.0

4 years ago