What is wrong with this Javascript? shopping cart

后端 未结 3 1099
自闭症患者
自闭症患者 2021-01-29 13:47

There is something in this javascript or html which is is allowing the checkboxes to be ticked but for not even half a second. (I need the checks to stay there!) I also need the

3条回答
  •  春和景丽
    2021-01-29 14:01

    Half of your if statements are missing parentheses, that's some basic wrongfulness.

    I don't know what and where should any of the variables be, but here is my best shot:

    function addItems(field) {
        var i;
        for (i = 0; i < field.length; i++) {
            if (field[i].checked === true) {
                if (computer[i] !== null) { 
                    selected[i] = computer[i];
                }
            }
        }
    }
    

提交回复
热议问题