39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
<html>
|
|
<head>
|
|
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
|
<script src="../src/mailcheck.js"></script>
|
|
<title>Mailcheck</title>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Mailcheck</h1>
|
|
<p>For a demo, enter [email protected] or [email protected] in the field below:</p>
|
|
<input id="email" name="email" type="email" />
|
|
<input name="Submit" type="submit" />
|
|
<p id="suggestion"></p>
|
|
|
|
<script>
|
|
var domains = ['hotmail.com', 'gmail.com', 'aol.com'];
|
|
var topLevelDomains = ["com", "net", "org"];
|
|
|
|
$('#email').on('blur', function(event) {
|
|
console.log("event ", event);
|
|
console.log("this ", $(this));
|
|
$(this).mailcheck({
|
|
domains: domains, // optional
|
|
topLevelDomains: topLevelDomains, // optional
|
|
suggested: function(element, suggestion) {
|
|
// callback code
|
|
console.log("suggestion ", suggestion.full);
|
|
$('#suggestion').html("Did you mean <b><i>" + suggestion.full + "</b></i>?");
|
|
},
|
|
empty: function(element) {
|
|
// callback code
|
|
$('#suggestion').html('No Suggestions :(');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
|