Disable click until page fully loads

Viewed 231

I'm trying to disable click on the button on the page before the page fully loads. I've tried the code below, which should active the click for a particular element when the page is loaded:

<script>
  $(document).ready(function() {
    $("div#wc-proceed-to-checkout").click(function () {
      launchAction();
    });
  });
</script>

Alternative solution - disable click for the whole page until the page fully loads.

2 Answers

Your script:

<script>
    $(document).ready(function() {
       $("div#wc-proceed-to-checkout").disable(false);
         $("div#wc-proceed-to-checkout").click(function () 
             {
                    launchAction();
           });
         });
 </script>

The HTML element must have disable true, or you can

<script> document.getElementById("wc-proceed-to-checkout").disable = true;
</script>
Related