代码无法在iOS上运行

时间:2017-07-13 11:50:01

标签: javascript jquery

以下代码不适用于iOS手机。 android降低版本。但是在桌面和笔记本电脑上工作。这段代码有什么问题?我可以包含jQuery更高版本库文件吗?

<!doctype html>
    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
    <script>
      $(document).ready(function() {


              var arr1=["ABOP","ABOF","hion","Afbo","afof","allaboutfashioncom"];
              var arr2 = ["Ajio", "Ajio", "Aajio", "Ageo", "Ajiyo", "Ajiyoo", "Ageoo"];
              $("button").click(function(){

                var res = 0;
                var v1 = $.trim($("input[type='text']").val());

                for (var i = 1; i < 3; i++) {
                  if (i == 1) {
                    for (var j = 0; j < arr1.length; j++) {
                      if (v1.toLowerCase() === arr1[j].toLowerCase()) {
                        res = i;
                      }
                    }
                  }
                  if (i == 2) {
                    for (var j = 0; j < arr2.length; j++) {
                      if (v1.toLowerCase() === arr2[j].toLowerCase()) {
                        res = i;
                      };
                    }
                  }
                }
                if (res > 0) {
                  res = res - 1;
                  $("table.SRTable tr").eq(res).find("input:radio").prop("checked", "true");
                } else {
                  $("table.SRTable tr").eq(2).find("input:radio").prop("checked", "true");
                }

              });
            });


    </script>
    </head>
    <body>
    <input type="text" id="text1">
    <table class="SRTable">
    <tr>
    <td class="radio">
    <input type="radio" class="radio" name="A1" value="1" id="A1_1">
    <td>
    <td class="item" ><span class="OptionFont">ABOP</span></td>
    </td>
    </tr>
    <tr>
    <td class="radio">
    <input type="radio" class="radio" name="A1" value="2" id="A1_2">
    <td>
    <td class="item" ><span class="OptionFont">Ajio</span></td>
    </td>
    </tr>
    <tr>
    <td class="radio">
    <input type="radio" class="radio" name="A1" value="3" id="A1_3">
    <td>
    <td class="item" ><span class="OptionFont">others</span></td>
    </td>
    </tr>
    </table>
    <button>Click</button>
    </body>
    </html>

0 个答案:

没有答案