I'm hoping to make a tool for myself aka a javascript bookmark that I can use on webpages specifically google forms, i wanted to loop through all questions on a page and add helpful tips or maybe definitions of words if thats what the question was asking. Im having issues appending children to every element, at the moment only the last question is getting anything appended. Heres some of the code im using for this
var x = document.createElement("P");
var t = document.createTextNode("This is an example of some notes");
x.appendChild(t);
//getting list of questions
var questions = document.getElementsByClassName("freebirdFormviewerComponentsQuestionBaseHeader");
for(var i = 0;i<questions.length;i++){
x.innerHTML=i;
questions[i].appendChild(x);
console.log(i);
}
//for some reason only the last question has text visible
thank you!
edit: heres the link to the form im using, ive tried other forms aswell but they problem remains the same. The output from the console.log is as follows code 0 1 2 3 4 //up to the number of questions so i think it may just be a visual bug https://docs.google.com/forms/d/e/1FAIpQLSfuvQKv0KtayB8MwQ-oYj5kf6K8I8dWIzJhqeDqMWZdwMY1mQ/viewform