good afternoon programmers I have a very big question and I hope you can help me I have a function called usu which takes values from a div to be exact I take them with the valiable request the joke esque if I can get a child but I can not get the value of the father but the son consulted on the basis of the father
function usu(){
var persona=document.getElementById("persona").innerHTML;
var lista=document.getElementById("lista");
var pedido=document.getElementById("lista-pedido");
var radioid;
var cantid=[];
var produc=[];
if(pedido.childNodes.length>1){
var tamaño2=pedido.childNodes.length;
for(var i=1; i<tamaño2; i++){
var mesa2=pedido.childNodes[i];
cantid.push(document.getElementById(mesa2.id+"-1").innerHTML);
}
}
if(pedido.childNodes.length>1){
var tamaño=pedido.childNodes.length;
for(var i=1; i<tamaño; i++){
var comida=pedido.childNodes[i];
produc.push(comida.value);
}
}
alert(cantid);
console.log(cantid);
console.log(produc);
}
The correct thing would be to do this but it does not work either, it detects me to produce as an undefined
if(pedido.childNodes.length>1){
var tamaño2=pedido.childNodes.length;
for(var i=1; i<tamaño2; i++){
var mesa2=pedido.childNodes[i];
produc.push(mesa.value);
cantid.push(document.getElementById(mesa2.id+"-1").innerHTML);
}
}
I would appreciate your help to get the value of the div with the value of 227 thanks