Why did I get [object HTMLParagraphElement]

后端 未结 2 1945
醉酒成梦
醉酒成梦 2021-01-02 16:03

I am a newbie. Here is my code:


  
    

        
2条回答
  •  天命终不由人
    2021-01-02 16:50

    It should be:

    document.getElementById("comment_content").value =
        document.getElementById("username").innerHTML
    

    Without the .innerHTML, it will try to copy in the actual element, not its content.

提交回复
热议问题