{"id":13526127,"url":"https://github.com/stripe-archive/jquery.mobilePhoneNumber","last_synced_at":"2025-04-01T06:31:17.779Z","repository":{"id":17271114,"uuid":"20040845","full_name":"stripe-archive/jquery.mobilePhoneNumber","owner":"stripe-archive","description":"[DEPRECATED] A general purpose library for validating and formatting mobile phone numbers.          ","archived":true,"fork":false,"pushed_at":"2020-04-07T20:02:18.000Z","size":100,"stargazers_count":331,"open_issues_count":6,"forks_count":46,"subscribers_count":47,"default_branch":"master","last_synced_at":"2024-08-09T02:37:43.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stripe-archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-21T23:24:28.000Z","updated_at":"2024-06-25T04:43:53.000Z","dependencies_parsed_at":"2022-07-26T16:15:14.623Z","dependency_job_id":null,"html_url":"https://github.com/stripe-archive/jquery.mobilePhoneNumber","commit_stats":null,"previous_names":["stripe/jquery.mobilephonenumber"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fjquery.mobilePhoneNumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fjquery.mobilePhoneNumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fjquery.mobilePhoneNumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stripe-archive%2Fjquery.mobilePhoneNumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stripe-archive","download_url":"https://codeload.github.com/stripe-archive/jquery.mobilePhoneNumber/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222703737,"owners_count":17025838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:25.565Z","updated_at":"2024-11-02T10:31:35.505Z","avatar_url":"https://github.com/stripe-archive.png","language":"CoffeeScript","funding_links":[],"categories":["CoffeeScript"],"sub_categories":[],"readme":"# Project status\n\nThis project is deprecated.\n\nWe will patch jquery.mobilePhoneNumber for critical security issues, but won't be adding any new features.\n\n# jQuery.mobilePhoneNumber [![Build Status](https://travis-ci.org/stripe/jquery.mobilePhoneNumber.svg?branch=master)](https://travis-ci.org/stripe/jquery.mobilePhoneNumber) [![CDNJS](https://img.shields.io/cdnjs/v/jquery.mobilephonenumber.svg)](https://cdnjs.com/libraries/jquery.mobilephonenumber/)\n\nA general purpose library for validating and formatting mobile phone numbers.\n\n```javascript\n$(\"input.phone-num\").mobilePhoneNumber();\n```\n\nYou can bind to an event when the user changes the country of the phone number:\n\n```javascript\n$(\"input.phone-num\").bind(\"country.mobilePhoneNumber\", function(e, country) {\n  console.log(\"The new country code:\", country);\n});\n```\n\nYou can find a [demo here](http://stripe.github.io/jquery.mobilePhoneNumber/example).\n\nDependencies:\n\n- [jQuery.caret](http://plugins.jquery.com/caret)\n- Tested on jQuery 1.8.3 and 1.11.1\n\n## API\n\n### \\$.fn.mobilePhoneNumber([options])\n\nEnables phone number formatting.\n\nOptions:\n\n- `defaultPrefix`: allows the user to type a phone number without the prefix for this specific value.\n\nExample:\n\n```javascript\n$(\"input.phone-num\").mobilePhoneNumber({\n  defaultPrefix: \"+1\"\n});\n```\n\n### \\$.fn.mobilePhoneNumber('val')\n\nReturns the phone number value with prefix, but without other formatting.\n\nExample:\n\n```javascript\n$(\"input.phone-num\").val(); //=\u003e '+1 (415) 123-5554'\n$(\"input.phone-num\").mobilePhoneNumber(\"val\"); //=\u003e '+14151235554'\n```\n\n### \\$.fn.mobilePhoneNumber('validate')\n\nReturns whether the phone number is valid.\n\n_Note:_ this implementation is very naive; it only validates that the phone number is longer than its prefix.\n\nExample:\n\n```javascript\n$(\"input.phone-num\").val(); //=\u003e '+1 (415) 123-5554'\n$(\"input.phone-num\").mobilePhoneNumber(\"validate\"); //=\u003e true\n\n$(\"input.phone-num\").val(); //=\u003e '+43'\n$(\"input.phone-num\").mobilePhoneNumber(\"validate\"); //=\u003e false\n```\n\n### \\$.fn.mobilePhoneNumber('country')\n\nReturns the two-letter country code of the phone number.\n\nExample:\n\n```javascript\n$(\"input.phone-num\").val(); //=\u003e '+32 495 12 34 56'\n$(\"input.phone-num\").mobilePhoneNumber(\"country\"); //=\u003e 'BE'\n```\n\n### \\$.fn.mobilePhoneNumber('prefix')\n\nReturns the prefix of the phone number.\n\nExample:\n\n```javascript\n$(\"input.phone-num\").val(); //=\u003e '+32 495 12 34 56'\n$(\"input.phone-num\").mobilePhoneNumber(\"prefix\"); //=\u003e '+32'\n```\n\n### \\$.formatMobilePhoneNumber(phone)\n\nReturns the formatted phone number.\n\nExample:\n\n```javascript\n$.formatMobilePhoneNumber(\"14151235554\"); //=\u003e '+1 (415) 123-5554'\n```\n\n## Events\n\n### country.mobilePhoneNumber\n\nTriggered when the country has changed.\n\nExample:\n\n```javascript\n$(\"input.phone-num\").bind(\"country.mobilePhoneNumber\", function(e, country) {\n  console.log(\"The new country code:\", country);\n});\n\n// Simulate user input\n$(\"input.phone-num\")\n  .val(\"+32495123456\")\n  .keyup();\n//=\u003e The new country code: BE\n```\n\n## Building\n\nRun `cake build`\n\n## Running tests\n\nRun `cake test`\n\n## Mobile recommendations\n\nWe recommend you set the `pattern`, `type`, and `x-autocompletetype` attributes, which will trigger autocompletion and a numeric keypad to display on touch devices:\n\n```html\n\u003cinput class=\"phone-num\" type=\"tel\" pattern=\"\\d*\" x-autocompletetype=\"tel\" /\u003e\n```\n\nYou may have to turn off HTML5 validation (using the `novalidate` form attribute) when using this `pattern`, since it won't permit spaces and other characters that appear in the formatted version of the phone number.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe-archive%2Fjquery.mobilePhoneNumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstripe-archive%2Fjquery.mobilePhoneNumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstripe-archive%2Fjquery.mobilePhoneNumber/lists"}