我是一名有帮助的助手,可以为您提供翻译。以下是需要翻译的内容:
我正在尝试遵循 jQuery 教程,使用 http://www.jqueryscript.net/form/jQuery-International-Telephone-Input-With-Flags-Dial-Codes.html 上的代码,在表单中创建带有国家代码的数字输入类型。然而,我的情况是,虽然标志似乎在变化,但是国家代码并没有像演示中显示的那样添加到输入字段中。
以下是他们提供的代码:
<head>
<meta charset="utf-8">
<title>International Telephone Input</title>
<link rel="stylesheet" href="build/css/intlTelInput.css">
<link rel="stylesheet" href="build/css/demo.css">
</head>
<body>
<form>
<input id="mobile-number" type="tel">
<button type="submit">Submit</button>
</form>
<!-- Load jQuery from CDN so can run demo immediately -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="build/js/intlTelInput.js"></script>
<script>
$("#mobile-number").intlTelInput({
//allowExtensions: true,
//autoFormat: false,
//autoHideDialCode: false,
//autoPlaceholder: false,
//defaultCountry: "auto",
//ipinfoToken: "yolo",
//nationalMode: false,
//numberType: "MOBILE",
//onlyCountries: ['us', 'gb', 'ch', 'ca', 'do'],
//preferredCountries: ['cn', 'jp'],
//preventInvalidNumbers: true,
utilsScript: "lib/libphonenumber/build/utils.js"
});
</script>
这是我正在尝试实现的链接:https://www.easyaccom.com/mobile/verifynumber.html
我已经尝试更改脚本中被注释掉的选项,但没有帮助。