I am trying to implement the mailcheck jquery plugin from https://github.com/Kicksend/mailcheck and I am able to have it work successfully.
But the problem is that it works fine in Firefox and in Chrome(sometimes) but not in Opera.
How to test?
1) Go the link http://oxwall-demo.iyaffle.com/join and it will open a sign-up form
2) In the "'Email" field, enter "[email protected]" without the quotes and move to the next field
After the focus is out of the field, email spelling suggestion will appear below the text box. This behaviour works as expected in some browsers and not in other browsers.
Is my code browser dependent or its the browsers which interpret my code differently? Please point any mistakes in my code.
NOTE: There are no any errors in the browser debug consoles in any browsers.
jQuery being used:
<script type="text/javascript">
$(document).ready(function(){
var domains = ['hotmail.com','gmail.com','aol.com','outlook.com','yahoo.com','yahoo.in'];
var topLevelDomains = ['com','net','org','info','me','co.uk','co.in','in'];
$("input.ow_email_validator:eq(0)").parent().append("<div id=\"correction\"></div>");
$(document).on("blur", "input.ow_email_validator", function() {
$("input.ow_email_validator:eq(0)").mailcheck({
suggested: function(element, suggestion) {
if(!$("#correction").html()) {
var suggestion = "Did you mean <span class=\"suggestion\">" +
"<span class=\"address\">" + suggestion.address + "</span>"
+ "@<a href=\"#\" class=\"domain\">" + suggestion.domain +
"</a></span>?";
$("#correction").html(suggestion).fadeIn(150);
}
else{
$(".address").html(suggestion.address);
$(".domain").html(suggestion.domain);
}
}
});
});
$("#correction").on("click", ".domain", function() {
$("input.ow_email_validator:eq(0)").val($(".suggestion").text());
$("#correction").fadeOut(200, function() {
$(this).empty();
});
return false;
});
});
</script>