开发者

open the jquery-ui dialog from radiobutton

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'开发者_StackOverflow中文版);
              });


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜