1

I am displaying a modeless jquery dialog on top of a page. When the dialog is displayed I wish to only allow the user to interact with a certain portion of the page (mainly because I do not want them naving away or clicking other controls that cause postbacks). I thought it would work well to use the same mechanism that jquery uses with a modal dialog except instead of disabling the entire page, disable all but the portion I wish to remain active. Does someone know how jquery modal dialog does this or have a better suggestion?

tim
  • 1,371
  • 3
  • 19
  • 30
  • 2
    Modal does it by applying an overlay over the whole page. Not by disabling the elements. – JohnP Jun 16 '11 at 12:17
  • So I could either use modal and try to set my editable divs z-order higher. Or use modeless and create an overlay and set the editable's z-order higher? – tim Jun 16 '11 at 12:21
  • I'm not sure whether you could add a higher Z index as jQuery might be calculating that at run time. Your best best would be to disable or set the visibility to to none when you don't want your page to be editable. – JohnP Jun 16 '11 at 12:23

1 Answers1

1

If you only want to prevent posting/navigation, then use window.unload to capture and prevent the event.

If you need to selectively disable input controls, then apply the disabled property to those controls.

You can do this easily by assigning a class to every object that you want to disable or enable for a given circumstance, e.g. with jquery

$('.blocked-input-controls').prop('disabled',true);
Jamie Treworgy
  • 23,934
  • 8
  • 76
  • 119
  • As a note: `.load()` and `.unload()` are deprecated. [See here](http://api.jquery.com/category/events/document-loading/) – Nick Jul 17 '12 at 13:55
  • Heh, actually I had meant to say "window.onunload", but apparently I was wrong whether or not I was referring to a browser vs. jquery method/event. I think. It was a long time ago. – Jamie Treworgy Jul 17 '12 at 14:19