tags:

views:

9

answers:

1

I have a dialog confirmation that must be reused for several controls in a html page.

Each change in a select, fire this dialog.

This is my code:

  console.info("before:" + select[0].id);
  dialog = $('#dialogReject').dialog(
  {
    autoOpen:false,
    height:300,
    width:400,
    modal:true,
    buttons:
    { "Ok":
      function() {
        console.info("after:" + select[0].id);
      },
    } 
  });

  dialog.dialog('open');

So, I have 2 selects. I change the first, show the dialog. The id in before & after are equal.

I select the second, change it and show the dialog. Now in before the correct id is displayed but in after is the id of the first select.

How avoid this?

A: 

Im not sure I entirely understand the question, but if you are trying to change content in a dialog you will probably need to .destroy() it after it was called the first time. Let me know if this isn't helpful and hopefully I/someone else can shed some more light on it.

Edit: That wording was vague. What I meant by that was try calling the .destroy() method when you close the dialog and you should have no problem with 'caching'.

HurnsMobile
Yes, destroy do the trick
mamcx