0

My jQuery click event does not work when I use the "strict mode" in my external javascript file. The "use strict"; is placed on top of the file.

However, the click event does works when using the script in the head of the file.

The version of safari is 601.1 and ios 9.3.3

Strict mode seems to have advantages regarding standardisation and long term stability of the code. So, I guess it's the way to go.

This issue of Safari and jQuery click event happens here , here etc.

If possible, I'd like to keep using the strict mode. Thanks

The script is:

$(document).ready(function() {
    "use strict";

    [ A lot of code here ];

    function addMoreInfoBtnToggle() {
        $("#addMoreInfoBtn").toggle();
        $(".addMoreInfo").toggle();
    }       
    var addMoreInfoBtn_clicked = $("#addMoreInfoBtn_clicked").val();
    if(addMoreInfoBtn_clicked === '1'){addMoreInfoBtnToggle();}
    $("#addMoreInfoBtn").click( function (e) { 
        e.preventDefault;
        addMoreInfoBtnToggle();
        $("#addMoreInfoBtn_clicked").val('1');
    });
});
Community
  • 1
  • 1
Mike Casan Ballester
  • 1,690
  • 19
  • 33

0 Answers0