summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-06-11 22:48:42 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-06-11 22:48:42 +0200
commit5981a400ba76921588a3769d94087309082ca97c (patch)
treeb3801db7fea33a24adc4fe99db440b811a7b1fa8
parent99ec25bbb6f410ae33f09ee75ae005f5ffcdffcf (diff)
Added an example page for ensuring that browser import works as expected
Fix #10
-rw-r--r--example/index.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/example/index.html b/example/index.html
new file mode 100644
index 0000000..d28e0ae
--- /dev/null
+++ b/example/index.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>South African ID Parser Test Page</title>
+ </head>
+
+ <body>
+ <input id="idNumber" />
+ <pre id="result"></pre>
+
+ <script src="../south-african-id-parser.js"></script>
+ <script>
+ var input = document.getElementById("idNumber");
+ var output = document.getElementById("result");
+
+ input.addEventListener("input", function(e) {
+ let result = saIdParser.parse(e.target.value);
+ output.innerText = JSON.stringify(result, null, 2);
+ });
+ </script>
+ </body>
+</html>