Increment a number inside a div?

前端 未结 4 426
难免孤独
难免孤独 2020-12-11 08:43

i have this

13

and I want to increment this number by +1 when I click a button

How can I do that

4条回答
  •  臣服心动
    2020-12-11 09:07

    Try following

    $('.likes').click(function() {
       $(this).text(+($(this).text()) + 1);
    });
    

    (edited my initial post)

提交回复
热议问题