skip to Main Content

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


  1. You can try using the disabled attribute on button to disable it.
    https://www.w3schools.com/tags/att_button_disabled.asp
    and once the page loads remove the attribute
    using – removeAttr('disabled') method

    Login or Signup to reply.
  2. 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>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search