-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!doctype html> | ||
|
||
<!-- | ||
Sample page to generate and validate isikukood. | ||
--> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title></title> | ||
<style> | ||
#result { | ||
font-size: 1.6em; | ||
color: green; | ||
} | ||
|
||
#result.invalid { | ||
color: #d00; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<h1>Estonian Personal ID</h1> | ||
|
||
<form id="form-personal-id"> | ||
<h4>Validate personal Estonian ID</h4> | ||
<input type="text" name="personal-id" id="personal-id" placeholder="Your Estonian personal ID" maxlength="11"> | ||
<button type="submit" class="minimal">Validate</button> <button id="generate" class="minimal">Generate</button> | ||
<br> | ||
<span id="result" class="invalid"></span> | ||
</form> | ||
|
||
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> | ||
<script src="isikukood.min.js"></script> | ||
<script> | ||
$(function () { | ||
$("#form-personal-id").on('submit', function (event) { | ||
event.preventDefault(); | ||
var val = $("#personal-id").val(); | ||
var ik = new Isikukood(val); | ||
if (ik.validate()) { | ||
$("#result").removeClass("invalid").html("Personal ID is valid"); | ||
} else { | ||
$("#result").addClass("invalid").html("Personal ID is invalid"); | ||
} | ||
}); | ||
|
||
$("#generate").click( function (event) { | ||
event.preventDefault(); | ||
$("#personal-id").val(Isikukood.generate()); | ||
}); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |