> > 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