Compatibility between iOS9.3 and Jquery

  1. problem, the method of writing using Jquery cannot be executed on iOS9"s Wechat browser.
  2. The code for
  3. is as follows.

HTML:

/**
 *
 */
$("-sharpcancle_button").click(function(){
    alert("");
});

/**
 *
 */
$("-sharpsubmit_button").click(function(){
    submitExam();
});

//
function submitExam() {
    var hadAnswer = 0;
    var examMap = new Map();
    var ids = $(".exam-item");
    $(ids).each(function (i) {
        var queId = $(ids[i]).data("id");
        var ans = $(ids[i]).children(".exam-ans").children(".ans-item");
        $(ans).each(function (j) {
            var answerRef = $(ans[j]).children("i");
            examMap.set(queId,"");
            if($(answerRef).hasClass("true")){
                examMap.set(queId,answerRef.attr("ref"));
                return false;
            }
        });
    });
    $("-sharpexamMap").val(JSON.stringify(strMapToObj(examMap)));
    $("-sharpexamFrom").submit();
}
function strMapToObj(strMap) {
    let obj = Object.create(null);
    for (let [k,v] of strMap) {
        obj[k] = v;
    }
    return obj;
}

the device is iPhone 5s (iOS9.3), and any other phone can. There was no response after clicking submit for this version. Finally, I located the problem on the method of submitting the test paper. It should be that some syntax in this method cannot be recognized on iOS9, or there is a problem with the jquery version (2.1.1). Please help to see what problems exist in this method. I write in the background, and js is really unable to do so.

Mar.15,2021

you can compile the code with babel and convert the new syntax to the old syntax (introducing polyfill at the same time)


ios 9.3 does not support es6 syntax

Menu