Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
16825 efrain 1
<!DOCTYPE html>
2
<html>
3
  <head>
4
    <meta charset="utf-8">
5
    <title>Example: National Mode</title>
6
    <link rel="stylesheet" href="../css/prism.css">
7
    <link rel="stylesheet" href="../../build/css/intlTelInput.css?1603274336113">
8
    <link rel="stylesheet" href="../../build/css/demo.css?1603274336113">
9
 
10
 
11
    <!-- GOOGLE ANALYTICS -->
12
    <script>
13
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
14
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
15
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
16
      })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
17
      ga('create', 'UA-85394876-1', 'auto');
18
      ga('send', 'pageview');
19
    </script>
20
    <!-- /GOOGLE ANALYTICS -->
21
  </head>
22
 
23
  <body>
24
    <a href="/">Back</a>
25
    <h1>Example: National Mode</h1>
26
    <p>Allow users to enter their national number, and then convert it to international format using the public method getNumber.</p>
27
 
28
    <h2>Markup</h2>
29
    <pre><code class="language-markup">&lt;p id=&quot;output&quot;&gt;Please enter a valid number below&lt;/p&gt;
30
&lt;input id=&quot;phone&quot; type=&quot;tel&quot;&gt;
31
</code></pre>
32
 
33
    <h2>Code</h2>
34
    <pre><code class="language-javascript">var input = document.querySelector(&quot;#phone&quot;),
35
  output = document.querySelector(&quot;#output&quot;);
36
 
37
var iti = window.intlTelInput(input, {
38
  nationalMode: true,
39
  utilsScript: &quot;../../build/js/utils.js?1603274336113&quot; // just for formatting/placeholders etc
40
});
41
 
42
var handleChange = function() {
43
  var text = (iti.isValidNumber()) ? &quot;International: &quot; + iti.getNumber() : &quot;Please enter a number below&quot;;
44
  var textNode = document.createTextNode(text);
45
  output.innerHTML = &quot;&quot;;
46
  output.appendChild(textNode);
47
};
48
 
49
// listen to &quot;keyup&quot;, but also &quot;change&quot; to update when the user selects a country
50
input.addEventListener(&#39;change&#39;, handleChange);
51
input.addEventListener(&#39;keyup&#39;, handleChange);
52
</code></pre>
53
 
54
    <h2>Result</h2>
55
    <div id="result">
56
      <p id="output">Please enter a valid number below</p>
57
<input id="phone" type="tel">
58
 
59
    </div>
60
 
61
    <script src="../js/prism.js"></script>
62
    <script src="../../build/js/intlTelInput.js?1603274336113"></script>
63
    <script src="./js/nationalMode.js?1603274336113"></script>
64
  </body>
65
</html>