views:

34

answers:

1

dear all.. i have one group of radiobutton:

<div id="id1">
<input id="pack1" type="radio" class="pack" name="pack" value="OK" />OK
<input id="pack2" type="radio" class="pack" name="pack" value="NG" />NG
</div>

i want if the radiobutton which id="pack2" is checked,the jquery-ui modal form dialog will appear.i have tried like this but doesn't work:

$("#pack2").click(function(){
              $("#mydialog").dialog('open');
              });
A: 

The jQuery dialog widget has an 'auto-open' option, that is true by default.

So you don't need to call the 'open' method. Just do:

$("#pack2").click(function(){
  $("#mydialog").dialog();
});

(By calling open like you have, you're calling a function on a dialog that hasn't been properly constructed.)

If you want to reuse the dialog, call .dialog on your dialog div in your document ready handler:

$(document).ready(function() {
  $('#mydialog').dialog({
    autoOpen: false
  });

  // ...

});

Then you can open it as you have done.

Reference here

sje397
i want to set "auto-open: false"
klox
Demo [here](http://jsfiddle.net/9RXzc/)
sje397