jQuery - Increase the value of a counter when a button is clicked

前端 未结 7 1304
轻奢々
轻奢々 2020-11-27 02:50

I\'m making a system where a user clicks a button and their score increases. There is a counter which I would like to increase the value of using jQuery (so that the page do

相关标签:
7条回答
  • 2020-11-27 03:46
    $(document).ready(function() {
    var count = 0;
    
      $("#update").click(function() {
        count++;
        $("#counter").html("My current count is: "+count);
      }
    
    });
    
    <div id="counter"></div>
    
    0 讨论(0)
提交回复
热议问题