开发者

Loading a jquery-ui dialogbox on clicking a link

开发者 https://www.devze.com 2023-02-20 09:02 出处:网络
I have antag as follows: <a onClick=\"showDialog();\"> <?php Print $s; ?> </a> In my document.ready() function, i have the showDialog() function

I have an tag as follows:

<a onClick="showDialog();"> 
    <?php Print $s; ?> 
</a>

In my document.ready() function, i have the showDialog() function

function showDialog()
{
    $('#userdata').dialog('open');
}

And i make the dialog not to appear, by including this in my document.ready() function

$("#userdata").dialog({autoOpen:false}); 

Also, in my body section, i have the "userdata" div element

<div id="userdata">hello</div>

But,when i click on the link, nothing happens.... But if i add an alert() inside the showDialog() function, it is getting triggered. can someone tell me how to display t开发者_开发问答he jquery dialog box ?

thanks


When a link is clicked it will open content in dialog box.

var p = '<p>test test test test test test</p>';
$('a').click(function(){    
    $(p).dialog({
       ...
    });

Check working example at http://jsfiddle.net/msKZt/2/


on your click event of the link add this

$('#ElementID').dialog('open');
0

精彩评论

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

关注公众号