HTML/Javascript Button Click Counter

前端 未结 5 1232
南笙
南笙 2020-12-09 10:24

I have done something similar to this before, and I know this is really close. I\'m just trying to make it so that my button increments the javascript variable, and the func

5条回答
  •  猫巷女王i
    2020-12-09 10:58

    Through this code, you can get click count on a button.

    
    
    
        
        Button
        
    
    
        
    
        
    
    
     ----------JAVASCRIPT----------
    let count = 0;
    function myFunction() {
      count+=1;
      document.getElementById("btn").innerHTML = count;
    
     }
    

提交回复
热议问题