<ul id= "Comments_list" > <li class= "comments" > <div class= "com_top" > <span C lass= "Photo" > </span> <span class= "name" > Wind up < /SPAN> </div> <div class= "com_content" > if we all have tacit understanding, that time is longer and what relationship. I like words that have feelings. Write the reality and warm. Take your headphones and close your eyes and listen to this "Let's just, stay together later." And all my life. "</div> <div class=" Com_bottom "> <span class=" Time ">2017-04-18</span> <s Pan class= "useful" > <span class= "like_num" >1</span> useful </span> </div> & Lt;/li> </ul>
CSS Section
. Com_bottom. useful{
Float:right;
font-size:10px;
padding:0 15px;
Text-align:center;
line-height:20px;
border-radius:10px;
Color: #999999;
border:1px solid #999999;
Com_bottom. Useful.usefulclick {
color: #F32D27;
border:1px solid #F32D27;
}
JS part
Point of Praise
$ ("#comments_list li.comments. Useful"). Click (function () {
var $likeNum = $ (this). Find ('. Like_num ');
var num = + $likeNum. Text ()
if (!$ (this). Hasclass (' Usefulclick ')) {
$ (this). addclass (' Usefulclick ');
$likeNum. Text (++num);
else{
Console.log ("tag has Usefulclick");
}
);