简体   繁体   English

jQuery Ui和动态内容

[英]jQuery Ui and dynamic content

I use jquery ui and want to have ui-tabs on ajax injected html. 我使用jquery ui,并希望在ajax上注入html的ui标签。

If I use the code from documentation: 如果我使用文档中的代码:

$(function() {
    $( ".tab" ).tabs();
});

on already existing HTML-Elements, it works. 在已经存在的HTML元素上,它可以工作。

But now, I want to open an jquery ui dialog with ajax content. 但是现在,我想打开一个带有ajax内容的jquery ui对话框。 Is there a possibility that the html inside is already converted to the jquery ui tab system? 里面的html是否有可能已经转换为jQuery ui选项卡系统?

Here is an example to load dynamic content before displaying the dialog box 这是在显示对话框之前加载动态内容的示例

<div id="dialog-message" title="Download complete">
    Default value
</div>

  $(function() {
    //Ajax call to load new text inside dialog-message
    $("#dialog-message").load("ajaxpage.php",function(){

        //Success callback, create and display the modal dialog

        //Delete dialog if already exists
        try{$(this).dialog('destroy');}catch(e){}

        //Create the new one
        $( this ).dialog({
          modal: true,
          buttons: {
            Ok: function() {
              $( this ).dialog( "close" );
            }  
          }
        });
    });
  });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM