Reputation: 625
Getting Exception parsing document error in for (var i = 0; i < Memoryval.length; i++)
line.
Can anybody 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();
}
});
Upvotes: 3
Views: 119
Reputation: 47099
I suspect that you have a non breaking space before Memoryval
in that line, and it got removed while copy/paste to StackOverflow:
$ charinfo " " " "
U+00A0 NON-BREAKING SPACE [Zs]
U+0020 SPACE [Zs]
It is possible to write a non breaking space, for instance pressing apple icon+space on OS X will cause this character to printed. These spaces might cause problems for The Spring Framework.
Upvotes: 1