Add disable attribute on to all elements

Does anyone know how to add “disable attribute” to all elements when button is clicked?

Hi there,

Please define “all elements”.

The following snippet will disable all inputs on a page on button press (where the button has an id of “myButton”)

$("#myButton").on("click", function(){
  $("input").prop('disabled', true);
});