Hi Matt,
Was that not working? That should work too. It shouldn't matter if you're using a DOM element or a jQuery object, just as long as you cache it so that the element doesn't get lost. So this is also valid: <script type="text/javascript"> $(function() { var myBlock = $('#myBlock'); // cache jq obj $().ajaxStart(function() { $.blockUI(myBlock); }).ajaxStop($.unblockUI); }); Mike On 4/13/07, Matt Grimm <[EMAIL PROTECTED]> wrote:
Ah, excellent, that worked nicely. I had been citing this snippet from the "Page blocking" section that led me astray: // embedded content used as message var messageElement = $('#domMessage'); $('#pageDemo4').click(function() { $.blockUI(messageElement); test(); }); m. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Alsup Sent: Friday, April 13, 2007 4:34 AM To: [EMAIL PROTECTED] Subject: [jQuery] Re: BlockUI: DOM element removed after first unblock Hi Matt, To reuse a DOM element as the blocking content you must cache a reference to it. That's how the DOM examples work at http://www.malsup.com/jquery/block/. This is necessary because you are free to use a different message or element for every blocking call so unblock always removes the message from the DOM. The following should work for you: <script type="text/javascript"> $(function() { var myBlock = $('#myBlock')[0]; // cache it $().ajaxStart(function() { $.blockUI(myBlock); }).ajaxStop($.unblockUI); }); Hope this helps. Mike On 4/12/07, Matt Grimm <[EMAIL PROTECTED]> wrote: > > > Mike, I guess I have one other lingering issue with blockUI that I hope you > can help with. I have a custom DOM element that I have been using as my > blockUI overlay, which I pass like so: > > $.blockUI( $('#block-message') ); > > My overlay element is just a div containing a single h1 and an input > (type=button). > > What is happening now is that it is removing the whole #block-message > element after the first $.unblockUI call. I can verify that it is deleted > with Firebug, and future calls to $.blockUI just show the transparent iFrame > with no dialog. > > I did try to pass the dialog as a DOM element or a jQuery object, either > declared in a variable or passed directly to the function. Nothing seems to > be working. > > Thanks again, > m. > >