Prasad
Prasad

Reputation: 59491

disable all controls in the page using jquery

How to disable all the controls(buttons, anchor, textbox,...) in the page using jquery. I need this to show a preview of a page, in which i don't want to the user to click anything.

Upvotes: 4

Views: 13838

Answers (3)

Tommaso Taruffi
Tommaso Taruffi

Reputation: 9252

$("#id_button").attr("disabled","disabled");

or

$(".class_buttons").attr("disabled","disabled");

or

$(":input").attr("disabled","disabled");

Upvotes: 14

rahul
rahul

Reputation: 187030

The best way will be to show a div on top of all other elements. Make the stacking order of this div to be the highest in the document so that click won't be made on any other elements.

Specifying the stack level: the 'z-index' property

Upvotes: -1

Darrell Brogdon
Darrell Brogdon

Reputation: 6973

This may work:

$(document).click(function(evt){ evt.preventDefault; });

Upvotes: 0

Related Questions