1

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 "adfd@gnail.com" 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>
Infinite Recursion
  • 6,511
  • 28
  • 39
  • 51
Purus
  • 5,701
  • 9
  • 50
  • 89
  • "Is my code browser dependent or its the browsers which interpret my code differently?" Is there a difference between the two? – bengoesboom Sep 14 '13 at 18:06
  • Have you checked the Javascript console for errors in the browsers that it doesn't work with? – Barmar Sep 14 '13 at 18:14
  • Yeah, I believe there is a difference between these 2. I meant, have I added any jquery syntax which is browser dependent or although the code is neat, is it the browser behave differently? Sorry if I am wrong :) – Purus Sep 14 '13 at 18:14
  • There are no errors in consoles in any browsers. The jquery code is correct. – Purus Sep 14 '13 at 18:15
  • I can't connect to your site, and downforeveryoneorjustme.com says it's down. – Barmar Sep 14 '13 at 18:16
  • For me it works. Please try after sometime as some cron jobs might be running as its midnight now here in IST. – Purus Sep 14 '13 at 18:17
  • Can you make a jsfiddle.com demo instead of using your real site? – Barmar Sep 14 '13 at 18:18
  • It doesn't look like a load problem, the TCP connection isn't opening. Something is blocking connections. – Barmar Sep 14 '13 at 18:19
  • Its possible to make a fiddle with simple example. But it will work for sure. The real problem here is the framework that I use (oxwall) handles the form elements like textbox differently. Thats why I gave the actual link to give the actual problem – Purus Sep 14 '13 at 18:20
  • 1
    See this page: http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html. Do you really need to use delegation for your `blur` event? Are `.ow_email_validator` elements added dynamically? – Barmar Sep 14 '13 at 18:21
  • Thanks for link. I will see on it and try. Yes, the class .ow_email_validator and other such form attribtues like name, id are generated dynamically. You can notice that by seeing different id and name values for the same textbox elements in different browsers. – Purus Sep 14 '13 at 18:23
  • DFEOJM now says the site is up, but I still can't connect to it. Looks like a routing problem between Comcast and your hosting service. – Barmar Sep 14 '13 at 18:30
  • This demo site is accessible by many around the world. I am really not sure what's happening at your side. Sorry about that. – Purus Sep 14 '13 at 18:34
  • Any help would be really helpful from any. – Purus Sep 18 '13 at 05:51

0 Answers0