JS_댓글 추가하기

백수·2022년 7월 3일
0

westragram 댓글 생성 기능

const commntUp = ()=>{
    let createEl =document.createElement("p");
    //p태그를 생성하는 변수
    
    let repleVelue = document.getElementById('reple_input');   
   //p태그에 안에 들어갈 내용 input태그//
   
    let write_comment = newReple.appendChild(createEl);
    //newreple(리플이 출력될 위치)에 밑에 자식으로 p생성//
   
     

    write_comment.innerHTML = `
                                <strong>Wecode</strong>${repleVelue.value} 
                                <span class="pl15 del_button" style="cursor:pointer;padding:20px">삭제</span>
                                <span class="material-symbols-outlined comment_like " style="flat:right;">favorite</span>
                                `;
     //변수안에 들어갈 내용//                           
                                
    createEl.classList.add("comments");  
    //p태그의 클래스 부여//
    

    repleVelue.value ="";
    //input 내용 빈문자열로 댗[



    
}

innerHTML로 생성될 코드를 줄여보았다.

profile
안녕하세요백수아빠입니다.

0개의 댓글