Thak you mike, let me present the whole scenarii. I have several buttons wich should block a section with different div> I add the ID of the div in Button Name, and made the following code:
$( function() { var $div; $('.button2').click(function() { $div = $('#' + $(this).attr('name')); $('#tdPlayer').unblock().block($div); }); $('.cancel').click( function(){ $('#tdPlayer').unblock(); }); }); for the same result is it a way to make the page that I described it> thanks again for your reply. On Jan 20, 9:35 am, "Mike Alsup" <[EMAIL PROTECTED]> wrote: > > When the button is clicked the div is shown and after cancel is > > clicked the div is unblocked, but if I click again the page is blocked > > but the div is not shown. Any help would be greatly appleciated. > > Try this: > > $(function() { > var $div = $('#div'); > $('.button2'.click(function() { > $.blockUI($div); > $('.cancel').click($.unblockUI); > }); > > }); > > The problem that you are having is that when you invoke unblock, the > blocking element is removed from the DOM. Which means the next time you do > $('#div') you won't find the element. But if you cache it first you can use > it over and over. Note however, that you need to rebind the click handler > to the cancel button because event handlers are removed automatically by > jQuery. > > Mike