my button tag doesn’t react to my javascript ror 6 script tag

I didn’t get you first point,

2nd point Disable the button after the click for sometime to block the spammers

You can try this.

var btn = document.getElementById('btn');

let clickCounts = 0;

btn.onclick = function() { 
  if(clickCounts===2){
  
  this.setAttribute("disabled", true) 
  }
  console.log(clickCounts);
  clickCounts++;
};
<button id="btn">Click Here, I will disabled after 3 times</button>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top