<section id="clone_item" class="comment_content reply you">
<header class="comment_header">
<img src="assets/images/avatars/image-juliusomo.webp" alt="profile picture" class="comment_header-profile" id="profile_picture">
<span class="name_profile" id="profile_name">tuvieja</span>
<p class="time_post" id="post_count">5meses</p>
</header>
<main class="comment_main">
<form>
<textarea class="comment_text text_comment_area" rows="5" cols="33" disabled>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Eum nesciunt amet necessitatibus, eius asperiores veniam accusamus pariatur obcaecati quo doloremque ducimus sint a hic. Eius non ad incidunt similique deleniti?</textarea>
</form>
</main>
<div class="comment_footer">
<div class="score_count">
<button class="button_score">+</button>
<span class="score" id="score_rep">0</span>
<button class="button_score">-</button>
</div>
<div class="container_edit">
<button class="done_button-edit done_button">Done!!</button>
<button class="delete_button"><img src="assets/icons/icon-delete.svg" alt=""class="icon_reply"><span class="reply_text">Delete</span></button>
<button href="#" class="edit_button"><img src="assets/icons/icon-edit.svg" alt="" class="icon_reply"><span class="reply_text">Edit</span></button>
</div>
</div>
</section>
this is the html code and i do this in the .js script.
const cloneChild = document.getElementById("clone_item")
let help=[];
window.addEventListener("load", ()=>{
let aux=cloneChild.cloneNode(true)
help.push(aux)
})
sendPost.addEventListener("click", ()=>{
if(dataPost.value === ""){
dataPost.classList.add("active")
}else{
let aux=help[0];
aux = cloneChild.cloneNode(true)
dataPost.classList.remove("active")
aux.childNodes[3].children[0].children[0].value=dataPost.value
aux.childNodes[5].children[1].children[2].classList.add("edit_button")
articleFather.appendChild(aux)
dataPost.value=""
}
})
editElement.forEach((edit_button)=>{
edit_button.addEventListener("click", ()=>{
console.log("uwu")
edit_button.classList.toggle("active")
})
})
for some reason the code just don't work/affect the dom insertion what i did, any help how anyone can give me?. i click the button of the -div- not cloned and work but in the -div- cloned the code is not working..