Unexpected Java Script Error

Getting exceptions for parsing a document in a row for (var i = 0; i < Memoryval.length; i++).

Does anyone help?

Below is the code.

 $(".rad").click(function () {
     var Memoryval = ["Fixed"];
     var CPU = ["Fixed", "Utilization", "OwnBorrow", "Custom", "Conditional"];
     var sel = document.getElementById('ddltype');
     sel.innerHTML = "";
     if (this.value == "MEMORY") {
         for (var i = 0; i < Memoryval.length; i++) {
             var opt = document.createElement('option');
             opt.innerHTML = Memoryval[i];
             opt.value = Memoryval[i];
             sel.appendChild(opt);
         }
         $("#divOwnBorrow").hide();
         $("#divFixed").show();
         $("#divUtilization").hide();
         $("#spanid").show();

     }
     if (this.value == "CPU") {
         for (var i = 0; i < CPU.length; i++) {
             var opt = document.createElement('option');
             opt.innerHTML = CPU[i];
             opt.value = CPU[i];
             sel.appendChild(opt);
         }
         $('#ddltype option[value=OwnBorrow]').prop('selected', true);
         // $("#ddltype select").text("OwnBorrow");
         $("#divOwnBorrow").show();
         $("#divFixed").hide();
         $("#divUtilization").hide();
         $("#spanid").hide();
     }
 });
+4
source share
1 answer

I suspect you have a non-proliferating space before Memoryvalon this line, and it was deleted when copying / pasting in StackOverflow:

$ charinfo " " " "
U+00A0 NON-BREAKING SPACE [Zs]
U+0020 SPACE [Zs]

You can record unused space, for example, pressing apple icon+ spaceon OS X will print this character. These spaces can cause problems for the Spring Framework.

+1
source

Source: https://habr.com/ru/post/1616047/


All Articles