I'm having trouble getting elements that are inside other elements. I want to overwrite a text that was already written in my HTML document.
My HTML code:
Industry Experience
<li>
Project FIUBA, Algorithms and Programming I, Argentina, 2021
- Project FIUBA, Algorithms and Programming I, Argentina, 2022
My Javascript code:
function cambiar_parrafo_2(){
document.querySelector("input").style.display = "inline";
let container = document.querySelector(".col-12");
let texto = container.querySelectorAll("article > ul > li");
for (let i = 0; i < texto.length; i++) {
texto[i].textContent = "";
}
}
The Javascript code before only delete text into li elements, the function is call when user click an image (I didn't add that piece of code to avoid making it extensive)...
So, after deleting the text, I want to write something new given by the user on input but it doesn't overwrite it.
This is the code that I thought:
function asignar_palabras_2(value) {
let container = document.querySelector(".col-12");
let texto = container.querySelectorAll("article > ul > li > ul > li");
for (let i = 0; i < texto.length; i++) {
texto[i].textContent = value;
}
}
Thanks in advance for your answers.
