javascript - Uncaught ReferenceError: y is not defined -


it seems not checkboxes being checked saved values. looks overlooked item.appointmenttype[1] array of values , checkboxes[i].value string, , if statement never true. think nested loop necessary loop through item.appointmenttype[1]. should able use if statement compare checkboxes[i].value item.appointmentvalue[1][y] example. however, i'm not sure if code have written correct. can me rewrite work rest of code?

var checkboxes = document.forms[0].appointmenttype; for(var i=0; i<checkboxes.length; i++){     if(checkboxes[i].value === item.appointmenttype[1]){     checkboxes[i].setattribute("checked", "checked");     }     for(var ii=0; ii<item.appointmenttype.length; ii++){     if(checkboxes[i].value === item.appointmenttype[1][y]){         checkboxes[y].setattribute("checked", "checked");     }     } } 


Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

R - Plot: How to format in 10-base scientific notation and put it text, mtex, title etc functions? -

validation - How to pass paramaters like unix into windows batch file -