I have this button in HTML and I need to check if the button has been pressed to activate another function or not.
<button id="generator" class="button ripple" onclick="myFunction()">Berechnen</button>
    function printDiv(print) {
        if(document.getElementById('generator').clicked == true){
            var printContents = document.getElementById(print).innerHTML;
            var originalContents = document.body.innerHTML;
       
            document.body.innerHTML = printContents;   
            window.print();
            document.body.innerHTML = originalContents;
            
        }
        else{
            alert("pls select")
        }
       
   } 
     
    