Skip to content

Commit

Permalink
Use jQuery 3.3.1 for generator.html
Browse files Browse the repository at this point in the history
  • Loading branch information
dknight committed Feb 18, 2018
1 parent e40366e commit d230d42
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions generator.html
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>

0 comments on commit d230d42

Please sign in to comment.