JQuery BlockUI未取消阻止页面

JQuery BlockUI未取消阻止页面,jquery,Jquery,我有一个很奇怪的问题!我在我的一个页面中使用了blockUI JQuery插件,效果很好。我对另一个页面也做了同样的操作,当调用$unbuui时,它并没有取消阻止该页面 代码如下: function showCommentBox() { $("#commentBox").addClass("modalPopup"); alert($("#commentBox").hasClass("modalPopup")); $.blockUI( { mes

我有一个很奇怪的问题!我在我的一个页面中使用了blockUI JQuery插件,效果很好。我对另一个页面也做了同样的操作,当调用$unbuui时,它并没有取消阻止该页面

代码如下:

function showCommentBox() 
{      

    $("#commentBox").addClass("modalPopup");   

    alert($("#commentBox").hasClass("modalPopup")); 

    $.blockUI( { message: $("#commentBox") } );     
}

function cancelComment() 
{    
    alert($("#commentBox").hasClass("modalPopup")); 

    $.unblockUI();   
}

当在cancelComment函数中计算$(“#commentBox”).hasClass(“modalPopup”)时,不工作的页面返回“false”,而正常工作的页面返回true。

@Azam-上面发布的代码没有问题。没有理由不起作用。我直接复制了帖子中的代码,并在此中进行了测试。你自己看看吧

为了让它尽可能简单,这就是我在HTML正文中使用的全部内容

  <input type="button" value="Show Comment" onclick="showCommentBox()" /> 
  <div id="commentBox" style="display:none"><br/>  
    This is the text from the CommentBox Div<br/> 
    <input type="button" value="Cancel" onclick="cancelComment()" /> 
  </div>
在这里,我使用jQuery变量存储对commentBox DIV的引用,并将其传递给$.blockUI,这样对$.unbuui()的调用将正常工作

function showCommentBox() {
    $.currentBox = $("#commentBox");
    $.currentBox.addClass("modalPopup");   
    alert($.currentBox.hasClass("modalPopup")); 
    $.blockUI( { message: $.currentBox } );     
}

function cancelComment() {    
    alert($.currentBox.hasClass("modalPopup")); 
    $.unblockUI();   
}