• Resolved gandalfthegrey

    (@gandalfthegrey)


    Problem: Firefox (OS X and Windows) does not fire the “click” event if one clicks the html ‘accept’ button.

    Cause: The reason is that the DOM is not existing when the jQuery(document).ready()… function is compiled by Firefox. This problem does not affect Safari or Chrome.

    Solution: Usage of jQuery(‘#elementID’).live(‘click’, function ()….); This ensures that the binding of events takes place now or in future during DOM creation (see also jQuery live or http://encosia.com/dont-let-jquerys-document-ready-slow-you-down/

    Code snippet of a part of EU cookie law:
    WRONG:
    jQuery(“#pea_cook_btn, .eucookie”).click(function() { //
    euCookieConsent();
    });

    WORKS PERFECT:
    jQuery(“#pea_cook_btn, .eucookie”).live(‘click’, function () {
    euCookieConsent();
    });

    Dear developer team, please correct your ‘scripts.js’ file as soon as possible, otherwise your plugin is useless at least under Firefox.

    Best regards!

    https://ww.wp.xz.cn/plugins/eu-cookie-law/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marco Milesi

    (@milmor)

    Hello and thank you for reporting. Your changes and a “thank you” are live in version 2.7 🙂

    PS. With my Firefox 38 the bug didn’t happen.

    Hi Guys,

    The fix provided by gandalf does not seem to work when you use a recent version of jQuery. The live function has been deprecated in jQuery 1.7 and removed in jQuery 1.9 ..

    According to the documentation you now have to use the on function instead of the live .. this version seems to work on my side (including firefox)

    $(‘#pea_cook_btn’).on(‘click’, function () {
    euCookieConsent();
    });

    Cheers,
    Fred/

    Plugin Author Marco Milesi

    (@milmor)

    Thank you for reporting. Just fixed in v2.7.1

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘FIREFOX: 'accept' Button no click event’ is closed to new replies.