Search code examples
htmlformsdisable

Is it possible to disabel all HTML-Elements of a Form during a transaction is running


e.g. buttons..

<body disabled>

does not work

Thank you


Solution

  • The following script will select all descendants of your form element. You can use any selector to get the desired set of elements and apply this script to disable them all.

    <script >
    var form_elem=document.querySelectorAll("form *");
    for(var i of form_elem){
    i.setAttribute("disabled", true);
    }
    </script>