Answers for "html button click only once"

0

html button click only once

<script>
function doSomething () {
  // Remove onclick
  var element = document.getElementById("myDiv");
  element.onclick = "";

  // Do your processing here
  alert("Something is done!");

  // Re-enable after processing if you want
  // element.onclick = doSomething;
}
</script>

<div id="myDiv" onclick="doSomething()">
  Click Here To Do Something
</div>
Posted by: Guest on October-03-2020

Code answers related to "html button click only once"

Code answers related to "Javascript"

Browse Popular Code Answers by Language