+ 2
Guys i want to change the value of the Array with in another Array type from Loop how can i do it .
Answer is coming only Ethan and another is Undefined. https://code.sololearn.com/WCzIKtCjvSS5/?ref=app
6 Réponses
+ 2
I suggest using document.getElementsByTagName instead of what you used.
+ 1
your div has more than 2 childs, 3 of them are texts, and 2 of them are p tags
you can check which of them are p tag using .nodeName
+ 1
use this code:
var i = 0;
for(var x=0;x<arr.length;x++) {
if(arr[x].nodeName=="P") {
arr[x].innerHTML = name[i++];
}
}
+ 1
@M N
it is still not working
can you correct it in my
code and please comment
out were the mistake i did.
+ 1
you have 2 mistake:
1. the "P" must be capital not "p"
2. the c++ must be in if, so whenever tag is P then element c of name array sets to innerHtml and c inrease to refer to next element in name array