开发者

JQuery UI Asp.net 4

开发者 https://www.devze.com 2023-04-03 09:17 出处:网络
I am working with JQueryUI and Asp.net and encounter a dynamic 开发者_JS百科content problem: <div id=\"content\" title=\"\" style=\"color: #F7A356\">

I am working with JQueryUI and Asp.net and encounter a dynamic 开发者_JS百科content problem:

<div id="content" title="" style="color: #F7A356"> 
<%=ContentLabel.Text%>
</div>

    function OpenDialog() {

   // alert(document.getElementById("content").innerHTML);

        var $dialog = $('<div style="color: #F7A356"></div>')
            .html($("#content").text())
            .dialog({
                autoOpen: false,
                modal: true,
                height: 150,
            });


            $dialog.dialog('open');

    }

I would like to open a dialog when I click on a control and show the content.. but it failed with the above method....

it doesn't work even I just some a simple javascript alert function with the innerHTML.....It return nothing as well


this is how it should look like..

$(document).ready(function() {
      .dialog({
         autoOpen: false,
         modal: true,
         height: 150,
     });

       $('a .opendialog').click(function(){
           $('#content').dialog('open');
       }
    });

if this does not help please provide more html


You should add the newly created element to the document before opening the dialog. Try something like:

$('<div style="color: #F7A356"></div>')
    .html($("#content").html())
    .appendTo("body")
    .dialog({
        modal: true,
        height: 150
    });
0

精彩评论

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

关注公众号