Native js implements the function of replying to comments and js comments.
Implementation Principle
Function 1. Deletion Status
Use the removeChild () method.
Function 2. Top likes
Determine whether the text content is likes and modify the container text content that stores likes.
Function 3. reply to comments
Create a new comment and add it to the comment list.
Function 4. Click like in the reply
Determine if I have liked the image and perform the corresponding operations.
Function 5. Reply or delete
Determine whether the string is replied or deleted and perform the corresponding operation
The Code uses event proxies and triplicate operations to reduce the amount of code.
Each line of code has a detailed comment
Don't get bored with seeing so many codes at a glance
In fact, it is a very simple dom operation to view each function separately.
A little bit of digestion, read every line of code
Complete code
Note: copy the code to the local directory and replace the part.
<! DOCTYPE html>
The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!