开发者

jQuery UI Dialog Error: b("<div></div>").addClass("ui-widget-overlay") is undefined

开发者 https://www.devze.com 2022-12-23 16:53 出处:网络
I have the below code for my a Dialog box for a which contains a dropdown field KPMS.ServiceRequests.Status = {

I have the below code for my a Dialog box for a which contains a dropdown field

KPMS.ServiceRequests.Status = {

 showOptions : function(requestId, userId, requestType) {
  var url = BASE_URL+'service_requests/status_options/';

        $("#dialog-modal").dialog("destroy");
  $("#dialog-modal").load(url, {"request_id": requestId, "user_id": userId, "request_type":requestType}).dialog(
   {
    modal: true,
    title: "Update Status",
    buttons: {
     Cancel : function() {
      $(this).dialog('close');
     },
     Update: function() {
      alert(1);
     }
    }
   }
  );    
 }
}

There is an anchor tag to populate the Dialog

<a onclick="KPMS.ServiceRequests.Status.showOptions(9, 11, 'SR'); return false;" title="Update status" href="http://localhost/kitco/pms/#9"><img alt="[E]" title="Update" src="http://localhost/kitco/pms/images/edit.png"></a>

My problem is When i click the link for the first time the d开发者_StackOverflowialog box is populating properly. Then I closed the dialog using the cancel button, then again clicked the link to open the dialog and closed it. For the third click on the link I'm getting the below Javascript error, and Dialog box is not opened

Error: b("<div></div>").addClass("ui-widget-overlay") is undefined
Source File: http://localhost/kitco/pms/js/jquery-ui-1.8rc3.custom.min.js
Line: 199

How to solve this problem?


why do you keep destroying and rebuilding the dialog why not just build the dialog once and load/change the content of the dialog div ? I think that should solve the problem


Does it really say b? Should that not be $ or jQuery?

EDIT: nevermind, it's an internal jQuery call, so that explains the b. b should be an alias to the jQuery object (var b = this), so that means the div creation is working, but that addClass is not / is returning undefined.

Are you sending your document as application/xhtml+xml, perchance? I have had a lot of trouble with jQuery 1.4 and jQuery UI 1.8 when using XTML, not HTML. Just a hunch.

0

精彩评论

暂无评论...
验证码 换一张
取 消