js onclick only once code example
Example: 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>